Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Program Error - Cannot call SetFocus from within ...
Message
 
To
23/07/1998 15:01:13
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00120667
Message ID:
00120684
Views:
29
The real-world situation is as follows: I want the focus to move to the grid after the user selects a record to view from the combo box (no matter how the user selects it -- by mouse click, by making an entry via the keyboard and tabbing out of the field, etc). Am I making sense?

>Hi Chuck ---
>
>What is the realworld of what you are trying to do? Also, have you considered using the InterActiveChange method instead of Valid for this situation?
>
>
>
>>ERROR CONDITION:
>>'Program Error - Cannot call SetFocus from within a When, Valid, RangeHigh or RangeLow event.'
>>
>>CAUSED BY:
>>ThisForm.Grid1.Column1.SetFocus() in ThisForm.Combo1.Valid
>>
>>THE VFP5 HELP STATES:
>>Cannot call SetFocus from within a When, Valid, RangeHigh or RangeLow event (Error 2012)
>>
>>The SetFocus method conflicts with these events, which are testing to see if the object can get or lose focus.
>>
>>· You are calling SetFocus from a When event.
>>
>>Call SetFocus from the GotFocus event instead.
>>
>>· You are calling SetFocus from a Valid, RangeHigh, or RangeLow event.
>>
>>Call SetFocus from the LostFocus event instead.
>>
>>WHAT I DID:
>>I moved ThisForm.Grid1.Column1.SetFocus() to the Lost Focus event, per the VFP5 Help as noted above.
>>
>>PROBLEM REMAINING:
>>When you click on a selection from the dropdown list of Combo1, the Valid Event fires but the focus doesn't change. However, the focus will change if you hit the tab key while in Combo1 (causing the LostFocus Event to fire).
>>
>>SOLUTION: ???
>>Is there a way to call LostFocus from Valid anytime Valid fires? Thanks in advance, CH.
Chuck Henry
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform