Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Determine Significant Trailing Spaces in controls
Message
From
03/08/2007 17:02:57
 
 
To
03/08/2007 03:26:26
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01245320
Message ID:
01245905
Views:
25
>>I have a need to determine if trailing spaces have been entered into a textbox or a combobox by the user. If the user adds trailing spaces, then these are significant and part of the text expression. Normally the .Value property (or .DisplayValue) has the text padded with spaces to the full size allowed. I only want trailing spaces if they are entered by the user.
>>
>>I know I can trap the keystrokes and increment a counter if a SPACE is entered (reset if any other character entered), But I wonder if anyone has already "invented" this and has a ready solution. Thanks.
>
>try
>
>Format = 'F'
>* ControlSource = 'not a char Field'

I tried it -- it partially works. If the initial value has one or more trailing spaces, these are not displayed. So the user would then add the spaces, but this actually adds additional spaces. In debug the result value of the DispalyValue property does have the initial trailing spaces, but they are not displayed. Each time the control receives focus, any trailing spaces are removed from the display but are retained internally. So this would confuse the input from the perspective of the user. Seems to be a bug between the DisplayValue actual value and the display value as seen by the user.

So at this point, I am not sure this is a viable solution. I have a working class that traps the input from the user in Keypress and stores to the Tag property. Spaces are substituted for display when a gotfocus event occurs (spaces are retained when typed by the user).

Thanks for your input.
Previous
Reply
Map
View

Click here to load this message in the networking platform