I need a numeric get like calculator?

I need a numeric get like calculator?

Postby Horizon » Wed Dec 10, 2008 7:24 pm

As Topic,

Any advice?

Thanks
Regards,

Hakan ONEMLI

Harbour & MSVC 2022 & FWH 23.04
Horizon
 
Posts: 1322
Joined: Fri May 23, 2008 1:33 pm

Postby dutch » Thu Dec 11, 2008 5:20 am

Dear Horizon,

I don't know. Is it your need?

Regards,
Dutch

Code: Select all  Expand view
*------------------------------*
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
User avatar
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Postby Horizon » Thu Dec 11, 2008 9:02 am

Thanks Dutch,

I think these are function. How can I use them? SBUTTON also undefined.

Actually, I use Calcget.prg in console xharbour like below.

[code]
#define XHARBOUR


#ifndef _CALCGET_

#define _CALCGET_

#command @ <row>, <col> GET <var> [<clauses, ...>] ;
CALCPCT [<moreClauses, ...>] ;
=> @ <row>, <col> GET <var> [<clauses>];
SEND reader := { |get| NumGetReader(get)} ;
[<moreClauses>]

#endif


PROCEDURE TEST

SET CONFIRM ON

STORE 0 TO AA,BB,CC
clear

@ 3,5 SAY "NORMAL GET = " GET AA Pict "999,999,999.99"
@ 4,5 SAY "CALCGET GET = " GET BB Pict "999,999,999.99" CALCPCT
@ 4,35 SAY "Please press dot (.) to enter decimal"
@ 5,35 SAY "It removes all entered n
Regards,

Hakan ONEMLI

Harbour & MSVC 2022 & FWH 23.04
Horizon
 
Posts: 1322
Joined: Fri May 23, 2008 1:33 pm

Postby Silvio » Thu Dec 11, 2008 11:22 am

someone created something of it
search on utilities forum
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Postby Horizon » Fri Dec 12, 2008 1:02 pm

Hi,

I have downloaded the GetCalc.prg from Timm's thread. It is very usefull tool. But GetCalc is not solution for my needs.

Is there any more advice?

Thanks,
Regards,

Hakan ONEMLI

Harbour & MSVC 2022 & FWH 23.04
Horizon
 
Posts: 1322
Joined: Fri May 23, 2008 1:33 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 75 guests