Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Program Error - Cannot call SetFocus from within ...
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00120667
Message ID:
00121865
Vues:
54
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: ???
>Is there a way to call LostFocus from Valid anytime Valid fires? Thanks in advance, CH.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform