Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Visual Basic Classic (6 and earlier)
Expertise: Advanced
Oct 27, 2016

Something to Remember When Filtering Keystrokes

Filtering user input is extremely mundane. Who never captured user's keystrokes in a TextBox in order to avoid some forbidden input, such as numbers or letters?

If you went down this rabbit hole, here are some things to keep in mind:

  1. User can hit navigational keys like Left Arrow, Right Arrow, Home, End, or Tab. They are perfectly valid keys in a TextBox.
  2. Remember to allow selection combinations keys like Shift + Home, Shift + End, Shift + Left Arrow, and Shift + Right Arrow as well.
  3. Del and Back Space should never be filtered out.
  4. You should probably allow Ctrl + C and Ctrl + X combinations, but maybe restrict Ctrl + V.
  5. If you restricted Ctrl + V, you should think what to do when user right-clicks the TextBox and select Paste in the contextual menu that appears.
  6. If your TextBox has an associated Help context ID, you should allow the F1 key.
Oracy
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date