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
numeric get
- karinha
- Posts: 7932
- Joined: Tue Dec 20, 2005 7:36 pm
- Location: São Paulo - Brasil
- Been thanked: 3 times
- Contact:
Re: numeric get
Esto/This?
Regards, saludos.
Code: Select all | Expand
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 )
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Re: numeric get
Dear karinha,
unfortunately, this doesn't work.
![Image](https://www.hamelau.eu/tmp/testget.jpg)
The cursor starts at the red arrow not at the very right position.
unfortunately, this doesn't work.
![Image](https://www.hamelau.eu/tmp/testget.jpg)
The cursor starts at the red arrow not at the very right position.
- Antonio Linares
- Site Admin
- Posts: 42512
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 31 times
- Been thanked: 73 times
- Contact:
Re: numeric get
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
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
Re: numeric get
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
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
- Antonio Linares
- Site Admin
- Posts: 42512
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 31 times
- Been thanked: 73 times
- Contact:
Re: numeric get
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
Error description: Error BASE/1122 Argument error: TRANSFORM
Args:
[ 1] = U
[ 2] = C 9999999.99
It must be a number
Re: numeric get
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.![Sad :(](./images/smilies/icon_sad.gif)
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.
![Sad :(](./images/smilies/icon_sad.gif)
- Antonio Linares
- Site Admin
- Posts: 42512
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 31 times
- Been thanked: 73 times
- Contact:
Re: numeric get
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![Smile :-)](./images/smilies/icon_smile.gif)
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
![Smile :-)](./images/smilies/icon_smile.gif)