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
Expertise: Beginner
Apr 24, 1997

Detecting Multiple Simultaneous Keypresses

Question:
I need to know if you can have more than one keydown at a time because it won't let me turn and fire at the same time. Using the keydown event how do you tell when there is two or more keys down other than the shift, ctrl, and alt keys? like how can you tell when "A and B" are pressed.

Answer:
Unfortunately, the only keys that can modify other keys are the Shift, Ctrl, and Alt keys. If you press a letter or number key down with another you will get two KeyPress events. The best suggestion I can offer is to change your fire button to be the Ctrl key and your forward motion be the Shift key. You can detect when Ctrl and Shift are down together, or even the Alt key with them. Either way, you can only use those keys together with one alphanumeric character

DevX Pro
 
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