Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Keypress Syntax
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00020037
Message ID:
00020067
Views:
43
>>>Does someone know the correct syntax for keypress event if I want to have only a set of characters allowed, say
>>>for example (1,2,a,b,*,#) in a textbox?
>>>
>>>Something like:
>>>if inlist(chr(nkeycode),'1','2',etc)
>>>
>>>or !inlist() is better?
>>>what is the best way to do this?
>>
>>look in the format and inputmask help. there's a way there to limit the keys a user can enter into a field. it dates back to fox1 i think. it also allows the user to press the spacebar to step through the options.
>>
>>lots of help, eh? at least you'll recognize it when you see it.
>
>Couldn't find anything general in those props, but once I stopped being lazy and tried the Keypress a little, it works like a charm.
>
>if between(chr(nkeycode),'0','9') or inlist(chr(nkeycode),'a','b',etc)
> && do nothing
>else
> nodefault
> && message if needed
>endif
>
>for example allows only those listed chars entry.

if i remember, i'll look it up in the project we used it in this afternoon when i get back to my office.
Previous
Reply
Map
View

Click here to load this message in the networking platform