Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Program Error - Cannot call SetFocus from within ...
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00120667
Message ID:
00130130
Views:
60
realize this was discussed last month. but it is relevent to my work today. in my valid i also want to setfocus. a little confused about the "on error". i tried this and still got the vfp error message. do i have to "on error" something to throw away the vfp runtime error?


GRID1.COLUMN3.VALID
do column4_valid
this.column4.setfocus() && get vfp runtime error


PROCEDURE COLUMN4_VALID
on error && did not say anything else
return

thanks - brenda


>You can still use SetFocus() from within Valid event in VFP 5.
>Microsoft forcing an error message on this, but in fact the SetFocus still
>works. Create a simple ON ERROR routine to ignore the error and you are set.



>>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: ???
>>s there a way to call LostFocus from Valid anytime Valid fires? Thanks in advance, CH.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform