• Post Reply Bookmark Topic Watch Topic
  • New Topic

key events

 
Randall Twede
Ranch Hand
Posts: 4519
6
Java Python Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can you have multiple key events? by that i mean say you press the right arrow key, or a number on the numeric pad, then you press the letter c. does the second key event get fired? and i can catch both events?
 
Rob Spoor
Sheriff
Posts: 20820
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why don't you try it and find out?
 
Martin Vajsar
Sheriff
Posts: 3752
62
Chrome Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, this might depend on the keyboard (the hardware) you're using.

Keyboard generally generates repeated keydown events when you press and hold a key on the hardware level (I hope I remember it from my old DOS days correctly). When you press another key, the keyboard sends the keydown event for the new key and stops sending keydown events for the old key, even if you continue to hold it down. When you release a key, a keyup event is sent.

Moreover, some keyboards are able to register more keys pressed at once than others; I remember some keyboards marketed to gamers who needed to press multiple keys at once to execute certain actions in games. Cheaper keyboards might not send keydown events for the third or fourth key pressed simultaneously.

It's easy to try without writing a single line of code: simply open a document in some word processor, try to press various keys simultaneously and see what's happening. Just make sure not to save the document afterwards
 
Randall Twede
Ranch Hand
Posts: 4519
6
Java Python Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
from what you say, i don't think it will be a problem.
i might need to have 3 + left arrow + c (example)
i am just thinking about an idea at this point anyway
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!