FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour numeric get
Posts: 218
Joined: Mon Feb 07, 2022 09:54 PM
numeric get
Posted: Wed Jul 19, 2023 07:24 PM
I have an edit control in an rc file in which a user should enter a numeric value.
Maximum of six digits but no value assigned because I don't want the user suggest a Zero.
Just
local nRgNum
...
REDEFINE GET oGet VAR nRgNum OF oDlg ID 20 PICTURE "999999" RIGHTTOLEFT

When the get becomes active the cursor stands about in the middle of this control.
I want to place the cursor at the right end of the get.
But this is only possible if I initialize the variable with '0' ( which I don't want to show )

Is it possible to display an empty get with a cursor waiting for input at the right end?

Thanks for any idea
Detlef
Posts: 8523
Joined: Tue Dec 20, 2005 07:36 PM
Re: numeric get
Posted: Wed Jul 19, 2023 10:49 PM
Esto/This?
Code (fw): Select all Collapse
   LOCAL nRgNum := ( "      " )


   // in resource = RIGHT
   REDEFINE GET oGet VAR nRgNum OF oDlg ID 20 PICTURE "999999" RIGHTTOLEFT ;
      UPDATE

   oGet:bGotFocus = { || oGet:SetPos( 0 ), nil }

   REPLACE NUMBER WITH VAL( nRgNum )
Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 218
Joined: Mon Feb 07, 2022 09:54 PM
Re: numeric get
Posted: Thu Jul 20, 2023 09:13 AM
Dear karinha,
unfortunately, this doesn't work.

The cursor starts at the red arrow not at the very right position.
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: numeric get
Posted: Thu Jul 20, 2023 09:57 AM

Dear Detlef,

Please modify FWH\samples\testget.prg this way:

@ 2, 6 GET oGet VAR nNum OF oDlg SIZE 60, 10 PICTURE "9999999.99" RIGHTTOLEFT

it seems to work fine. Please try it

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 218
Joined: Mon Feb 07, 2022 09:54 PM
Re: numeric get
Posted: Thu Jul 20, 2023 10:46 AM

Dear Antonio,

this doesn't work as I need it.

If I initialize my variable with a numeric Zero it works.

But I don’t want to show a '0' inside the get. It should be empty.

Regards, Detlef

Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: numeric get
Posted: Thu Jul 20, 2023 10:49 AM

If nNum is declared as nil then this error is generated:

Error description: Error BASE/1122 Argument error: TRANSFORM

Args:

 [   1] = U

 [   2] = C   9999999.99

It must be a number

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 218
Joined: Mon Feb 07, 2022 09:54 PM
Re: numeric get
Posted: Thu Jul 20, 2023 11:09 AM
You are right, Antonio.

My problem is to let an user input an integer value with a maximum of 6 digits.
But without showing a zero in the get control.
I could take a string value with picture "999999" and after transform it to numeric with val( cVar ).
Then the cursor starts at the left side but I want an input mode from right to left.
I can't bring this to work. :(
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: numeric get
Posted: Thu Jul 20, 2023 11:17 AM
Dear Detlef,

Please modify this line in tget.prg this way:

FW_SayText( ::hDC, If( Empty( Eval( ::bSetGet ) ), "", Transform( Eval( ::bSetGet ), ::cPicture ) ), aRect, "R", ::oFont, ::nClrText )

now it works as you need :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 218
Joined: Mon Feb 07, 2022 09:54 PM
Re: numeric get
Posted: Thu Jul 20, 2023 12:25 PM
Many thanks, Antonio.
This works fine now. :D

Continue the discussion