When are keybinding preferable to handling key-up/key-down (.ect) events?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I think this entirely depends on your needs. Keybindings have some restrictions which event handlers do not. For example, with a keybinding you must have a key and a key modifier (unless you are using the function keys or the number pad keys). Additionally, if I remember correctly, you can’t catch just the keydown event with keybinding.
So let’s say you have a “repeat” function that you want to have happen when someone types a certain set of keys. Keybinding would allow you to quickly bind this function to the R+Alt key combination.
If on the other hand you wanted to set off the repeat function every time someone key-down only the R key but then do another function when the R key is released (key-up), you would need to use Event Handlers.