I cant seem to find this anywhere. I want to find the best way to check whether a keystroke is actually a character.
listeners:{
'keyup':function(f, e){
//Is key a letter/character
}
}
EDIT
Thanks to everyone who has answered, I DO know how to detect the actual key that was pressed, I want to know how to detect whether the key is actually a character (not arrows, backspace, enter etc)
To capture keyboard events you must set the enableKeyEvents
property on the component to true
.
...,
enableKeyEvents: true,
listeners:{
'keyup': function(f, e){
var charCode = e.getCharCode();
var key = e.getKey();
}
},
...
See "Detecting keystrokes" for a description of the difference between keyCode and charCode.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With