Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Text Box Value Bug
Message
 
To
13/02/2001 13:52:36
David Brunelle
Université de Sherbrooke
Sherbrooke, Quebec, Canada
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Miscellaneous
Thread ID:
00475397
Message ID:
00475415
Views:
37
>I was making a small application last time and I ran into a really weird bug and I was wondering if there was anything I could do to solve it.
>I had a text box in which I inputed a numeric value (the present year). There was only this text box and some buttons on the form. Whenever I pressed enter on the text box after entering a new value (this doesn't apply when I didn't change the original value) the number inside the text field change. At first, it deleted all or just some of the zeroes, and when there is only one digit in the field, the digit change into a zero. Is there anybody that encountered that same bug and got some anser for me?
>As a temporary solution, I give a string value coresponding to the date (STR(...)) and then reconvert it into an integer when I need it, but I'de rather avoid doing that if there is another way to do it.

Numeric fields have some strange behavior that goes all the way back to dBASE. I get around this by setting SelectOnEntry to .T. for my textboxes, so that whenever you start typing into the field, it completely replaces what was there. In order to get this to work properly with a mouse click, I have the following code in the GotFocus method of my textbox class:
if this.SelectOnEntry
   Dodefault()
endif
Another option is to have the numbers appear from right to left, as they do on a caculator. Jim Booth has a class to do this, which I believe you can download from his web site at www.jamesbooth.com.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform