FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour tget only numbers and "."
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
tget only numbers and "."
Posted: Wed Nov 09, 2022 09:37 AM
the user can digit only number and "." on a get

LOCAL oGet, cvar := Space(100)


@ 82, 2 GET oGet VAR cVar SIZE 200,20 PIXEL OF oBarRight NOBORDER FONT oFontGet

oGet:bChange := {|nKey|(Chr(nKey)$"0123456789.")}

why I can insert also characters ? (as you see in this picture )

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 1772
Joined: Thu Sep 05, 2019 05:32 AM
Re: tget only numbers
Posted: Wed Nov 09, 2022 10:30 AM
hi Silvo,
Silvio.Falconi wrote:the user can digit only number and "." on a get
what about using cPicture "99" :?:
greeting,

Jimmy
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: tget only numbers
Posted: Wed Nov 09, 2022 12:28 PM
Algo asi?
Code (fw): Select all Collapse
// C:\FWH..\SAMPLES\SILVGETN.PRG

#Include "FiveWin.ch"

STATIC oDlg, oFont

FUNCTION Main()

   LOCAL oGet, cVar := Space(100)
   LOCAL oBtnX2, cTitle, aGrad, oSay

   cTitle := "Cambia GET"

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0, - 14

   DEFINE DIALOG oDlg SIZE 600, 200  PIXEL TRUEPIXEL RESIZABLE  ;
      TITLE cTitle GRADIENT aGrad FONT oFont

   oDlg:lHelpIcon := .F.

   @ 12, 2 GET oGet VAR cVar SIZE 200,20 PIXEL OF oDlg FONT oFont ;
      PICTURE "@R 99,999,999,999.99"

   ACTIVATE DIALOG oDlg CENTERED ON INIT( CAMBIA_PICT( oGet ) )

RETURN NIL

FUNCTION CAMBIA_PICT( oGet )

  LOCAL cPict := "012345678912"

  oGet:VARPUT( cPict )
  oGet:Refresh()

RETURN( .T. )

// FIN / END
Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: tget only numbers
Posted: Wed Nov 09, 2022 12:40 PM
karinha wrote:Algo asi?
Code (fw): Select all Collapse
// C:\FWH..\SAMPLES\SILVGETN.PRG

#Include "FiveWin.ch"

STATIC oDlg, oFont

FUNCTION Main()

   LOCAL oGet, cVar := Space(100)
   LOCAL oBtnX2, cTitle, aGrad, oSay

   cTitle := "Cambia GET"

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0, - 14

   DEFINE DIALOG oDlg SIZE 600, 200  PIXEL TRUEPIXEL RESIZABLE  ;
      TITLE cTitle GRADIENT aGrad FONT oFont

   oDlg:lHelpIcon := .F.

   @ 12, 2 GET oGet VAR cVar SIZE 200,20 PIXEL OF oDlg FONT oFont ;
      PICTURE "@R 99,999,999,999.99"

   ACTIVATE DIALOG oDlg CENTERED ON INIT( CAMBIA_PICT( oGet ) )

RETURN NIL

FUNCTION CAMBIA_PICT( oGet )

  LOCAL cPict := "012345678912"

  oGet:VARPUT( cPict )
  oGet:Refresh()

RETURN( .T. )

// FIN / END
Regards, saludos.
NO

I must write a string no a price
I must write also "." sample: 36.67.80.7.3.23.45 and not PICTURE "@R 99,999,999,999.99"

because the tget control is read by a procedure that finds the numbers in the xbrowse and colors them as you can see here

oGet:bChange := {|nKey|(Chr(nKey)$"0123456789.")}
oGet:bKeyDown := { | nKey |(oGet:assign(), ActiveNavigator(cVar,oBrw,oItem2:lChecked)) }



Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: tget only numbers and "."
Posted: Wed Nov 09, 2022 01:33 PM
Code (fw): Select all Collapse
   PICTURE "99.99.99.9.9.99.99" //-> 36.67.80.7.3.23.45

https://vivaclipper.wordpress.com/2012/09/12/what-is-picture-function-template/

Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: tget only numbers and "."
Posted: Wed Nov 09, 2022 03:42 PM
karinha wrote:
Code (fw): Select all Collapse
   PICTURE "99.99.99.9.9.99.99" //-> 36.67.80.7.3.23.45

https://vivaclipper.wordpress.com/2012/09/12/what-is-picture-function-template/

Regards, saludos.
I not know the config of string
Can be 36.6 or 45.66 .78 or more numbers
Chat Is space(100)
Perhaps U not understood my problem
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: tget only numbers and "."
Posted: Thu Nov 10, 2022 04:21 AM
Code (fw): Select all Collapse
oGet:bKeyChar := { |k| If( chr( k ) $ ".0123456789", nil, 0 ) }
Regards



G. N. Rao.

Hyderabad, India
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: tget only numbers and "."
Posted: Thu Nov 10, 2022 06:15 AM
nageswaragunupudi wrote:
Code (fw): Select all Collapse
oGet:bKeyChar := { |k| If( chr( k ) $ ".0123456789", nil, 0 ) }
Thanks rao
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com

Continue the discussion