tget only numbers and "."

tget only numbers and "."

Postby Silvio.Falconi » Wed Nov 09, 2022 9: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 )

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
Silvio.Falconi
 
Posts: 6834
Joined: Thu Oct 18, 2012 7:17 pm

Re: tget only numbers

Postby Jimmy » 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
User avatar
Jimmy
 
Posts: 1590
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: tget only numbers

Postby karinha » Wed Nov 09, 2022 12:28 pm

Algo asi?

Code: Select all  Expand view

// 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
karinha
 
Posts: 7315
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: tget only numbers

Postby Silvio.Falconi » Wed Nov 09, 2022 12:40 pm

karinha wrote:Algo asi?

Code: Select all  Expand view

// 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
Silvio.Falconi
 
Posts: 6834
Joined: Thu Oct 18, 2012 7:17 pm

Re: tget only numbers and "."

Postby karinha » Wed Nov 09, 2022 1:33 pm

Code: Select all  Expand view

   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
User avatar
karinha
 
Posts: 7315
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: tget only numbers and "."

Postby Silvio.Falconi » Wed Nov 09, 2022 3:42 pm

karinha wrote:
Code: Select all  Expand view

   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
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
Silvio.Falconi
 
Posts: 6834
Joined: Thu Oct 18, 2012 7:17 pm

Re: tget only numbers and "."

Postby nageswaragunupudi » Thu Nov 10, 2022 4:21 am

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

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10295
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: tget only numbers and "."

Postby Silvio.Falconi » Thu Nov 10, 2022 6:15 am

nageswaragunupudi wrote:
Code: Select all  Expand view
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
User avatar
Silvio.Falconi
 
Posts: 6834
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 35 guests