Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Firing a method from an OKL?
Message
De
19/08/1998 08:20:48
 
 
À
18/08/1998 20:00:47
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00127489
Message ID:
00128061
Vues:
45
>>>Is there a way to execute a method of a control from an OKL, where the OKL is defined in the init of the form which contains the control? I want to run the Click() method of a button (which has no text prompt, just a graphic) by pressing a key sequence, like Ctrl-F. I have the following in the form's Init...
>>>
>>>ON KEY LABEL CTRL+F ThisForm.cmdFind.Click()
>>>
>>>... but I get the error "THISFORM can only be used within a method".
>>>
>>>Is there a way to do this???
>>
>>The easier way: ON KEY LABEL ... _VFP.ActiveForm.cmdFind.Click().
>>
>>HTH!
>
>Better yet. handle this in the form's keypress event. (OKLs are dangerous because they are interprocess commands that can interrupt running code and cause wierd stuff).
>Set you form.keypreview = .T.
>and put the following code in your form's keypress event:
>
>
>IF (nKeyCode = ASC("F") OR nKeyCode = ASC("f")) AND nShiftAltCtrl = 2
>     THISFORM.CmdFind.Click()
>     NODEFAULT
>ENDIF
>
Actually, I do not like OKL either. I define a PAD in the menu, and define BARs for each shortcut; for example, I would do something like
DEFINE BAR ... KEY CTRL+F,"Ctrl+F".
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform