Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Setfocus
Message
 
To
25/01/2000 13:48:11
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Miscellaneous
Thread ID:
00322326
Message ID:
00322397
Views:
19
>is there a reason why vfp won't let you "object.setfocus" in the WHEN or VALID method.
>
>just curious.
Yes there is a reason. Valid fires when the cotnrol is trying to lose focus. If you fire a SetFocus from inside the valid then you are AGAIN trying to send focus away and that should, in theory, fire the Valid again, and the SetFocsu, and the Valid, and the SetFocus, and the Valid, ... Get the idea.

So SetFocus is not allowed in a Valid event. Instead let the Valid do what it is desinged to do, decide if focus will be allowed to leave. If the Valid returns .T. the LostFocus will fire and that is where you can do your SetFocus call (Don't forget, in the LostFocus, to issue a NODEFAULT if you issue a SetFocus or else your SetFocus will fire and then VFP will move focus again on you).
Previous
Reply
Map
View

Click here to load this message in the networking platform