List of keyboard keys constants
-
I'm developping a tool class, and i'm in the process of handling keyboard events.
I searched on the online doc, but i can't find a list of correspondence between a keyboard key and a value (the key is passed as an integer).
Do such a list exist ?like
Sketchup::KEY_A -> 32
etc...
I hope it exists !! And if not, at least that the 'A' key will always map to the same value ?
-
It can vary between PC and MAC and also remember that 'A' is probably assigned to the Arc shortcut so pressing A inside your tool will be taken as a deactivate() and start Arc...
Keys like Esc call onCancel()
The keys safely accessible to tools are typically the modifiers Shift/Ctrl/Alt etc [listed in the Key methods of the Tool API https://developers.google.com/sketchup/docs/ourdoc/tool#onKeyDown] and Tab [up only as down on MAC is ignored] - the Arrow-keys will be OK provided no one has ill-advisedly made shortcuts to those... and of course the basic numerals 0-9, and [.,;] used in dim/point-input, /x* used in Copy [Move/Rotate] and '"cmfik etc used as unit suffixes, in dimensions etc...
There are several www sites setting out keyboard codes etc... http://en.wikipedia.org/wiki/Keyboard_layout#Character_keys http://help.adobe.com/en_US/AS2LCR/Flash_10.0/help.html?content=00000520.html etc -
Thanks for your answer TIG, using non modifier keys is indeed a bad idea inside a tool, because they are already bound to lots of different tools.
I also discovered that the int values corresponding to keystroke can be accesed like thisvalueFor_W_Key = ?W
a bit weird, but it works.
I ended up not using keys
Advertisement