Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Number-style character fields
Message
From
19/02/2008 02:55:00
 
 
To
18/02/2008 20:22:25
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
01293663
Message ID:
01293691
Views:
32
>>Try setting the value of the textbox to 0 (zero) or any number.
>
>Thanks.
>
>Well, that would be what I call an "unbounded" TextBox (, and perhaps I'll end up doing precisely that). By "unbounded" I mean that it doesn't have a ControlSource.
>
>The point is that the data is eventually stored in a character field, so I wanted to use the .ControlSource correspondingly; but that doesn't seem to work correctly.
>
>> ... And I would set the input mask to "999.99" (not #s).
>
>Actually, now I see that I have been doing exactly that; but it doesn't work, probably because the value of the .ControlSource isn't numeric.

Unbind the control in Gotfocus, and bind it back in lostfocus. Something like this, not tested:
*GotFocus
This.addproperty('cSource',this.controlsource)
This.addproperty('cOldValue',this.value)
This.controlsource=''
This.inputmask='999.99' && Maybe not necessary
This.value=val(this.cOldValue)

*LostFocus
Replace (this.cSource) with str(this.value,6,2)
This.controlsource=this.cSource
This.inputmask='' && Maybe not necessary
Adding the cOldValue property makes it easy to Escape back to the old value in KeyPress
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform