Keyboard Codes
The fourth outlet of the key and keyup objects output a keyboard-independent code you can use to detect key presses and releases as described below.
Letters and Numbers
When pressing a letter or number key, the values reported from this outlet correspond to the unshifted Unicode (ASCII) valuversion of the pressed key.
Other Characters
When pressing a key that is a character key but is not a letter or number, the Unicode value of the key symbol that would be output by the keyboard when the shift key is not depressed is output. (For example, on U.S. keyboards, there is a key with both a single and double quote. When this key is pressed, the key object will report single quote.
Other Keys
Other keys such as function, home, page up etc. output a consistent values independent of keyboard on each platform. The values are listed below:
- (none): -1
- Space bar: -2
- Escape: -3
- Return/Enter: -4
- Tab: -5
- Delete: -6
- Backspace: -7
- Insert: -8
- Up arrow: -9
- Down arrow: -10
- Left arrow: -11
- Right arrow: -12
- Page up: -13
- Page down: -14
- Home: -15
- End: -16
- F1 (function key): -17
- F2 (function key): -18
- F3 (function key): -19
- F4 (function key): -20
- F5 (function key): -21
- F6 (function key): -22
- F7 (function key): -23
- F8 (function key): -24
- F9 (function key): -25
- F10 (function key): -26
- F11 (function key): -27
- F12 (function key): -28
- F13 (function key): -29
- F14 (function key): -30
- F15 (function key): -31
- F16 (function key): -32
- 0 (number pad): -33
- 1 (number pad): -34
- 2 (number pad): -35
- 3 (number pad): -36
- 4 (number pad): -37
- 5 (number pad): -38
- 6 (number pad): -39
- 7 (number pad): -40
- 8 (number pad): -41
- 9 (number pad): -42
- Add (number pad): -43
- Subtract (number pad): -44
- Multiply (number pad): -45
- Divide (number pad): -46
- Separator (number pad): -47
- Decimal (number pad): -48
- Equals (number pad): -49
- Delete (number pad): -50
- Play/Pause: -51
- Stop: -52
- Nexttrack: -53
- Prevtrack: -54
- Help: -55
See Also
Name | Description |
---|---|
Technical Notes | Technical Notes |