Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
This.setfocus in valid method
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00013655
Message ID:
00013925
Views:
34
>>>>to check for a duplicate code, i tried using this.setfocus in a valid method, but it doesn't seem to work.
>>>>
>>>>if !tableupdate()
>>>> =messgebox('Duplicate code. Please reenter')
>>>> this.setfocus()
>>>>endif
>>>>
>>>>is there a better solution?
>>>I don't believe setfocus works from inside valid events. I think you have to use the tab order and tab out of the control (or to your self) I had a form where if the zip was found we wanted to skip the city/state with setfocus and ended up using the taborder.
>>>Gary
>>
>>You're right -- there is a KB bug doc on this. It basically says to use the lostfocus with nodefault instead to skip taborder...
>
>I use return to move around from the valid method
>
>return 0 (invalid, stay on field)
>return (valid, stay on field)
>return 1 (valid, move to next in tab order)
>return -1 (valid, move to prev in tab order)
>
>
>etc.

That works fine as long as you don't issue a setfocus in valid...
The Anonymous Bureaucrat,
and frankly, quite content not to be
a member of either major US political party.
Previous
Reply
Map
View

Click here to load this message in the networking platform