Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Keypress event does not function correctly
Message
From
09/07/1999 11:38:43
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00239445
Message ID:
00239470
Views:
15
>In an textbox or an editbox, when I want to restrict some keys, I set the "nKeyCode" parameter to 0. According to documentation, setting this to zero will make it forget that the key was pressed.
>
>The key still appears in the edit/text box. However, the same code works fine in Visual Basic.
>
>Textbox KeyPress Event:
>
>PARAMETERS nKeyCode, nShiftAltCtrl
>if !isalpha( chr(nKeyCode) )
> nKeyCode = 0 && this line has not effect in VFP
>endif
>
>How do I restrict Keys entered ?
>
>thanks
>
>Bharat

Instead of nKeyCode = 0 use:

NODEFAULT

This will keep VFP from processing the keystroke. So your code should look like:

if !isalpha( chr(nKeyCode) )
NODEFAULT
endif

Bill
William A. Caton III
Software Engineer
MAXIMUS
Atlanta, Ga.
Previous
Reply
Map
View

Click here to load this message in the networking platform