Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
KeyPress Event: Need for advice
Message
De
05/11/1997 06:17:44
Razvan Alexandru
Soft Team Solutions Srl
Bucharest, Roumanie
 
 
À
05/11/1997 05:08:22
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00058110
Message ID:
00058297
Vues:
31
>Thank you for a good advice. It helps me to find a workaround of my problem.
>
>By the way, i use KeyPreview=.T. and KeyPreview=.F. to switch the behaviour of the form. When I need some object (e.g. numeric input field) to recieve keystrokes, i use MyForm.KeyPreview=.F.
>After this i found out that when i am entering in this field digits, functional keys etc., the only keypress event fired is that of the object. But when i press Enter, both object's and form keypress event occurs. Strange behavior of VFP!
>
>That is why I should use NODEFAULT in keypress event of the form only for that keys, i need.
>
>Thanks in advance
>
>Alexander Mitchenko, Kiev, Ukraine

Hi,Alexander

Not only for digits and functional keys, but also for all keys that give the focus to another object.
The definition of KeyPreview = .F. says that KeyPress Event of the form does not intercept the KeyPress Event of the control.When you press ENTER, you leave the control and then, of course, the KeyPress Event of the form is triggered.
Try this: in KeyPress Event of the form use

IF ThisForm.KeyPreview = .F.
RETURN
ENDIF

case in which do not use NODEFAULT, because the focus remain in the current control.

HTH,

Razvan, Elena & Catalina

If you want, we can send you an example.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform