>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.
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only