Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
On key label triggers button click
Message
De
27/10/2002 19:00:30
Dragan Nedeljkovich
Now officially retired
Zrenjanin, Serbia
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Divers
Thread ID:
00715908
Message ID:
00715919
Vues:
16
>Hi,
>
>I have a form with a command button whose click event is also triggered by ON KEY LABEL F2.
>The event does fire. However, I would like the visual button click to show.
>How can I do this?

First, avoid On Key Label. There are other ways. The reason for this is that OKL runs out-of-context; it doesn't know the name of your form, has no sure way to reference it etc etc. Even if you made it run a .prg file, that file would need to find your form first - probably by traversing _screen.forms collection and looking for a button with a given caption, name or some other distinguishable property.

Two safer ways would be to either have a (optionally hidden) menu on the form which would have a hotkey for F2, or to have form.KeyPreview=.t., and to capture the case where nKeyCode=-1 (AFAIK, that's the code for F2) in form.keypress method. I'd prefer the latter, because that way everything is contained within the form.

Alternately (but this is a kludge, and I'm not sure it would work), you could have a hotkey on your button, if you include a "\<" string before the hotkey character in button's caption. If button.caption="Bu\ .Signature { margin-top: 12px; color: #666666; } .Signature a { color: #666666; }

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform