Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Why does {alt+} throw away activecontrol?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00668976
Message ID:
00669853
Vues:
13
Bill,
any time you use "Thisform.ActiveControl" always use it this way:

if type('Thisform.ActiveControl') = 'O'
lo = Thisform.ActiveControl
endif

This will stop the error you are getting. If no control on the form has focus you will get the error if you don't check it first. I think the menu commands are fine except that the Alt+... will remove focus from the form and put it on the menu instead so your code will never work. You may have to add a property to the form to hold a pointer to the current object and update it with the gotfocus of each control you expect to be in.

John.


>I have fixed this problem, but I want to know why it happens.
>
>Define myChkBox as ChkBox
>  Caption = 'Re\<fused'      && User can press {alt+f} to toggle value
>  Procedure When()
>    local lo
>    lo = Thisform.ActiveControl
>    This.Value = !This.Value
>    lo.SetFocus()
>    Return .F.
>  EndProd
>EndDefine
>
>This works just fine when the user clicks on the chkBox with the mouse, but if the user uses {alt+f} to do it, error "ACTIVECONTROL IS NOT AN OBJECT" and debugger shows "" for ActiveControl.
>
>Why does the keyboard shortcut throw away the ActiveControl?
Beer is proof that God loves man, and wants him to be happy. - Benjamin Franklin
John J. Henn
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform