Trigger button action using special key
Trigger button action using special key
Hi, I have read the buttons.buttons.key documentation and cannot figure out how to make this track by keycode for special cases like the "insert" key. How can we trigger a button's action when the "insert" key is pressed? I tried it by keycode, the word "insert", even tried a bunch of ascii escape sequences to no effect.
I'd also like to unmap this key from Keytable/editor - currently it edits the field you've selected, but it ought to just activate a particular button and do nothing else. Keytable offers a .keys configuration option but not a way to keep the default while excluding a single key, seemingly.
Thanks!
This question has an accepted answers - jump to answer
Answers
What is the keycode for the insert key? My keyboard doesn't actually have that key, so I can't check!
Normally what I do is:
to find out key codes I don't know!
Allan
Hi Allan, the code is 45. I usually use this site: http://keycode.info/
So, adding
key: 45
ought to have triggered the button, no?Aha, just dug through the source for Buttons and found this tricky solution:
String.fromCharCode(45)
This worked! May be helpful to add to the documentation
Thanks for posting back - good to hear you found a solution. I'll get something about that added in.
Allan