FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour I need a numeric get like calculator?
Posts: 1387
Joined: Fri May 23, 2008 01:33 PM
I need a numeric get like calculator?
Posted: Wed Dec 10, 2008 07:24 PM

As Topic,

Any advice?

Thanks

Regards,



Hakan ONEMLI



Harbour & MSVC 2022 & FWH 23.06
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM
I need a numeric get like calculator?
Posted: Thu Dec 11, 2008 05:20 AM
Dear Horizon,

I don't know. Is it your need?

Regards,
Dutch

*------------------------------*
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
Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)
Posts: 1387
Joined: Fri May 23, 2008 01:33 PM
I need a numeric get like calculator?
Posted: Thu Dec 11, 2008 09: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.06
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
I need a numeric get like calculator?
Posted: Thu Dec 11, 2008 11:22 AM

someone created something of it
search on utilities forum

Best Regards, Saludos



Falconi Silvio
Posts: 1387
Joined: Fri May 23, 2008 01:33 PM
I need a numeric get like calculator?
Posted: Fri Dec 12, 2008 01: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.06

Continue the discussion