Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Class to make character act like numeric field
Message
From
18/11/1998 11:16:00
 
 
To
18/11/1998 11:02:50
Pierre Sauve
Micro-Fox Canada Inc.
Montréal, Quebec, Canada
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00158808
Message ID:
00158820
Views:
17
>Hi everyone,
>
>I have created a class based on textbox where I have this following code in the gotfocus event :
>
>This.inputmask = replicate('9',len(this.value))
>This.value = padr(alltrim(this.value),len(this.value))
>This.refresh()
>
>Then , in the lostfocus event I have the reverse code :
>
>This.inputmask = ""
>This.value = parl(alltrim(this.value),len(this.value))
>This.refresh()
>
>The problem is that when I use this class inside a form , the different fields using that class show empty values . When the form comes up I would like to see the values for these fields as the are in the table and only execute the gotfocus/lostfocus code when the user tab in and out of these fields.
>What am I doing wrong ?
>Note that I also tried to put the code in the when/valid event combination without more success.
>
Hello Pierre,

It looks to me as though you may be creating an input mask composed entirely of one space. If so, this would account for the fact that the fields appear blank in your forms since the significant part of our field would be to the right of the input mask and would thus not show up.

Try changing the order of your code like this:

WITH this
.refresh() && load the control's value
.inputmask = replicate('9',len(.value))
.value = padr(alltrim(.value),len(.value))
*-- For VFP to repaint the control -- this may not be necessary. Try it
* without this line first.
.visible = .T.
ENDWITH
<\PRE>

regards,
Jim Edgar
Jurix Data Corporation
jmedgar@yahoo.com

No trees were destroyed in sending this message. However, a large number of electrons were diverted from their ordinary activities and terribly inconvenienced.
Previous
Reply
Map
View

Click here to load this message in the networking platform