Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
LostFocus vs. Valid in Comboboxes
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00264458
Message ID:
00264984
Views:
27
>You can't call SetFocus() from the Valid() method. Even if it's LostFocus() that call SetFocus(), it's illegal since LostFocus() is called from Valid()
>If the code in my LostFocus eventually calls a SetFocus, then calling the LostFocus from the Valid means that the Valid will eventually call a SetFocus, right?

The above almost sounds like a "Who's on first?" rendition for VFP... :-)

I ran into the *exact* same problem as Elyse a short time ago. I thought it was due to my extreme lack of experience with VFP, but I guess this is a bugger of a problem. I never found a fix for it, but what I've done as a sort of workaround is to put code into the LostFocus() that calls Refresh() if the invalid condition is met, then in Refresh(), call a messagebox and call SetFocus() if a valid condition for that ComboBox doesn't exist. It seems very ineficient, and for some reason, the whole process only fires twice for an invalid entry in the combo box. It's bad workaround, but at least the message box will pop up a few times to let the person know the value in the combobox needs to be corrected.

This is an in-house project so I'm not too worried about it, but I'm hoping I (we!) can find a fix for it before too long.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform