I am trying to simulate the keyboard stroke. When I press the -
key, I receive the following event.
What does the various codes mean?
[KEY_PRESSED, keyCode=45, keyText=Minus, keyChar='-', keyLocation=KEY_LOCATION_STANDARD, rawCode=189, primaryLevelUnicode=45, scancode=12]
KEY_PRESSED
is the event type.keyCode
is the code as integer of the key. Note that not all characters have a keycode associated with them. For example, there is no keycode for the question mark because there is no keyboard for which it appears on the primary layer. You can get a list of each code here.keyText
is the text description of the character.keyChar
is the typed char.keyLocation
is the location of the key that originated this key event. Some keys occur more than once on a keyboard, e.g. the left and right shift keys. Additionally, some keys occur on the numeric keypad. This provides a way of distinguishing such keys.primaryLevelUnicode
I believe this is the chart used to map the characters. Unicode have multiple levels of chart mostly usefull for comparison (collator).scancode
are sent to the computer to identify the key. See this answer for more details. You can get a list of scan codes here.Note that the
scancode
seems to be for MS Windows only as per comment inKeyEvent
: