As Topic,
Any advice?
Thanks
*------------------------------*
Function NumPad(oGetVar)
local oDlg, oBtn[12], oGet
local cNum, oFnt, oFnts
local nTop, nLeft
local n := 0
nTop := GETWNDRECT(oGetVar:oWnd:hWnd)[1] + GETCOORS(oGetVar:hWnd)[3] - 3
nLeft := GETWNDRECT(oGetVar:oWnd:hWnd)[2] + GETCOORS(oGetVar:hWnd)[2] + oGetVar:nWidth
DEFINE FONT oFnt NAME "Ms Sans Serif" SIZE 0, -10 BOLD
DEFINE FONT oFnts NAME "Ms Sans Serif" SIZE 2, -16 BOLD
DEFINE DIALOG oDlg FROM 0, 0 TO 153, 102 PIXEL ;
STYLE nOr( DS_MODALFRAME, WS_POPUP, WS_DLGFRAME, )
@ 0.0, 0.1 GET oGet VAR cNum OF oDlg ;
WHEN .F. ;
FONT oFnts ;
SIZE 51, 12 // PICTURE "@K999,999,999.99"
// Numbers
@ 4.75,7.90 SBUTTON oBtn[12] PROMPT "OK" OF oDlg SIZE 16, 15 ;
COLOR {|oBtn| If( oBtn:lMouseOver, CLR_YELLOW, CLR_BLACK ) }, CLR_HGRAY ;
ACTION ( oGetVar:VarPut( iif(oGetVar:oGet:Type='N',val(oGet:cText()),oGet:cText()) ), oDlg:End() ) ;
FONT oFnt DEFAULT ;
NOBORDER
@ 1.00,0.00 SBUTTON oBtn[1] PROMPT "1" OF oDlg SIZE 16, 15 ;
COLOR {|oBtn| If( oBtn:lMouseOver, CLR_YELLOW, CLR_BLACK ) }, CLR_HGRAY ;
ACTION SayNum( oGet, 1 ) FONT oFnt NOBORDER
@ 1.00,4.00 SBUTTON oBtn[2] PROMPT "2" OF oDlg SIZE 16, 15 ;
COLOR {|oBtn| If( oBtn:lMouseOver, CLR_YELLOW, CLR_BLACK ) }, CLR_HGRAY ;
ACTION SayNum( oGet, 2 ) FONT oFnt NOBORDER
@ 1.00,7.90 SBUTTON oBtn[3] PROMPT "3" OF oDlg SIZE 16, 15 ;
COLOR {|oBtn| If( oBtn:lMouseOver, CLR_YELLOW, CLR_BLACK ) }, CLR_HGRAY ;
ACTION SayNum( oGet, 3 ) FONT oFnt NOBORDER
@ 2.25,0.00 SBUTTON oBtn[4] PROMPT "4" OF oDlg SIZE 16, 15 ;
COLOR {|oBtn| If( oBtn:lMouseOver, CLR_YELLOW, CLR_BLACK ) }, CLR_HGRAY ;
ACTION SayNum( oGet, 4 ) FONT oFnt NOBORDER
@ 2.25,4.00 SBUTTON oBtn[5] PROMPT "5" OF oDlg SIZE 16, 15 ;
COLOR {|oBtn| If( oBtn:lMouseOver, CLR_YELLOW, CLR_BLACK ) }, CLR_HGRAY ;
ACTION SayNum( oGet, 5 ) FONT oFnt NOBORDER
@ 2.25,7.90 SBUTTON oBtn[6] PROMPT "6" OF oDlg SIZE 16, 15 ;
COLOR {|oBtn| If( oBtn:lMouseOver, CLR_YELLOW, CLR_BLACK ) }, CLR_HGRAY ;
ACTION SayNum( oGet, 6 ) FONT oFnt NOBORDER
@ 3.50,0.00 SBUTTON oBtn[7] PROMPT "7" OF oDlg SIZE 16, 15 ;
COLOR {|oBtn| If( oBtn:lMouseOver, CLR_YELLOW, CLR_BLACK ) }, CLR_HGRAY ;
ACTION SayNum( oGet, 7 ) FONT oFnt NOBORDER
@ 3.50,4.00 SBUTTON oBtn[8] PROMPT "8" OF oDlg SIZE 16, 15 ;
COLOR {|oBtn| If( oBtn:lMouseOver, CLR_YELLOW, CLR_BLACK ) }, CLR_HGRAY ;
ACTION SayNum( oGet, 8 ) FONT oFnt NOBORDER
@ 3.50,7.90 SBUTTON oBtn[9] PROMPT "9" OF oDlg SIZE 16, 15 ;
COLOR {|oBtn| If( oBtn:lMouseOver, CLR_YELLOW, CLR_BLACK ) }, CLR_HGRAY ;
ACTION SayNum( oGet, 9 ) FONT oFnt NOBORDER
@ 4.75,0.00 SBUTTON oBtn[10] PROMPT "0" OF oDlg SIZE 16, 15 ;
COLOR {|oBtn| If( oBtn:lMouseOver, CLR_YELLOW, CLR_BLACK ) }, CLR_HGRAY ;
ACTION SayNum( oGet, 0 ) FONT oFnt NOBORDER
@ 4.75,4.00 SBUTTON oBtn[11] PROMPT "<-" OF oDlg SIZE 16, 15 ;
COLOR {|oBtn| If( oBtn:lMouseOver, CLR_YELLOW, CLR_BLACK ) }, CLR_HGRAY ;
ACTION SayNum( oGet, "<" ) FONT oFnt NOBORDER
ACTIVATE DIALOG oDlg ON INIT oDlg:Move( nTop, nLeft ) RESIZE16
oFnt:End()
oFnts:End()
return .T.
*-------------------------------*
FUNCTION SayNum(oGet,xNum)
LOCAL cText := Alltrim(oGet:cText())
if ValType(xNum) == "C"
if xNum = "."
oGet:cText( padR(alltrim(cText)+".",100,' ') )
elseif xNum = '<'
oGet:cText( padR(left(alltrim(cText),len(cText)-1),100,' ') )
end
if xNum <> '.' .and. xNum <> '<'
xNum := val(xNum)
oGet:cText( padR(alltrim(cText)+cValToChar(xNum),100,' ') )
end
else
oGet:cText( padR(alltrim(cText)+cValToChar(xNum),100,' ') )
end
oGet:SetFocus()
Return Nil
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 107 guests