tget only numbers and "."

Post Reply
User avatar
Silvio.Falconi
Posts: 7133
Joined: Thu Oct 18, 2012 7:17 pm
Been thanked: 1 time

tget only numbers and "."

Post by Silvio.Falconi »

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 )

Image
Last edited by Silvio.Falconi on Wed Nov 09, 2022 1:20 pm, edited 1 time in total.
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 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
User avatar
Jimmy
Posts: 1740
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany
Has thanked: 2 times

Re: tget only numbers

Post by Jimmy »

hi Silvo,
Silvio.Falconi wrote:the user can digit only number and "." on a get
what about using cPicture "99" :?:
greeting,
Jimmy
User avatar
karinha
Posts: 7932
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil
Been thanked: 3 times
Contact:

Re: tget only numbers

Post by karinha »

Algo asi?

Code: Select all | Expand

// 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
User avatar
Silvio.Falconi
Posts: 7133
Joined: Thu Oct 18, 2012 7:17 pm
Been thanked: 1 time

Re: tget only numbers

Post by Silvio.Falconi »

karinha wrote:Algo asi?

Code: Select all | Expand

// 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)) }



Image
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 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
User avatar
karinha
Posts: 7932
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil
Been thanked: 3 times
Contact:

Re: tget only numbers and "."

Post by karinha »

Code: Select all | Expand

   PICTURE "99.99.99.9.9.99.99" //-> 36.67.80.7.3.23.45
 

https://vivaclipper.wordpress.com/2012/ ... -template/

Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
Silvio.Falconi
Posts: 7133
Joined: Thu Oct 18, 2012 7:17 pm
Been thanked: 1 time

Re: tget only numbers and "."

Post by Silvio.Falconi »

karinha wrote:

Code: Select all | Expand

   PICTURE "99.99.99.9.9.99.99" //-> 36.67.80.7.3.23.45
 

https://vivaclipper.wordpress.com/2012/ ... -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
Last edited by Silvio.Falconi on Thu Nov 10, 2022 6:14 am, edited 1 time in total.
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 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
User avatar
nageswaragunupudi
Posts: 10721
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 8 times
Contact:

Re: tget only numbers and "."

Post by nageswaragunupudi »

Code: Select all | Expand

oGet:bKeyChar := { |k| If( chr( k ) $ ".0123456789", nil, 0 ) }
Regards

G. N. Rao.
Hyderabad, India
User avatar
Silvio.Falconi
Posts: 7133
Joined: Thu Oct 18, 2012 7:17 pm
Been thanked: 1 time

Re: tget only numbers and "."

Post by Silvio.Falconi »

nageswaragunupudi wrote:

Code: Select all | Expand

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 November 2023 - January 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
Post Reply