Skip to content

KeyCode

The KeyCode enumeration is used to represent keys and includes many common keys that can be used to detect user input.

attributesdescription
NoneIndicates that no key is associated with this input event.
BackspaceRepresents the backspace key on the keyboard.
TabRepresents the Tab key on the keyboard.
ClearRepresents the Clear key on the keyboard.
EnterRepresents the Enter key on the keyboard.
PauseRepresents the Pause key on the keyboard.
ESCRepresents the Escape key on the keyboard.
SpaceRepresents the spacebar key on the keyboard.
ExclaimRepresents the exclamation mark (!) key on the keyboard.
DoubleQuoteRepresents the double quotation mark " key on the keyboard.
HashRepresents the pound sign # key on the keyboard.
DollarRepresents the $ key on the keyboard.
PercentRepresents the percent (%) key on the keyboard.
AmpersandRepresents the '&' key on the keyboard.
QuoteRepresents the single quote/double quote key on the keyboard.
LeftParenRepresents the left parenthesis "(" key on the keyboard.
RightParenRepresents the right parenthesis ( ) key on the keyboard.
AsteriskRepresents the asterisk (*) key on the keyboard.
PlusRepresents the plus sign + key on the keyboard.
CommaRepresents the comma key on the keyboard.
MinusRepresents the minus (-) key on the keyboard.
PeriodRepresents the period key on the keyboard.
SlashRepresents the slash key on the keyboard.
Alpha0The number 0 on the numeric keypad.
Alpha1The number 1 on the numeric keypad.
Alpha2The number 2 on the numeric keypad.
Alpha3The number 3 on the numeric keypad.
Alpha4The number 4 on the numeric keypad.
Alpha5The number 5 on the numeric keypad.
Alpha6The number 6 on the numeric keypad.
Alpha7The number 7 on the numeric keypad.
Alpha8The number 8 on the numeric keypad.
Alpha9The number 9 on the numeric keypad.
ColonRepresents the colon ":" key on the keyboard.
SemicolonRepresents the semicolon (😉 key on the keyboard.
LessRepresents the less than < key on the keyboard.
EqualsRepresents the equals sign = key on the keyboard.
GreaterRepresents the greater than > key on the keyboard.
QuestionRepresents the question mark/slash key on the keyboard.
AtRepresents the @ key on the keyboard.
LeftBracketRepresents the left square bracket [ key on the keyboard.
BackslashRepresents the backslash \ key on the keyboard.
RightBracketRepresents the right square bracket [ key on the keyboard.
CaretRepresents the caret symbol ^ on the keyboard.
UnderscoreRepresents the underscore (_) key on the keyboard.
BackQuoteRepresents the backtick ` key on the keyboard.
AThe A key on the keyboard.
BThe B key on the keyboard.
CThe C key on the keyboard.
DThe D key on the keyboard.
EThe E key on the keyboard.
FThe F key on the keyboard.
GThe G key on the keyboard.
HThe H key on the keyboard.
IThe "I" key on the keyboard.
JThe J key on the keyboard.
KThe K key on the keyboard.
LThe L key on the keyboard.
MThe M key on the keyboard.
NThe N key on the keyboard.
OThe O key on the keyboard.
PThe P key on the keyboard.
QThe Q key on the keyboard.
RThe R key on the keyboard.
SThe S key on the keyboard.
TThe T key on the keyboard.
UThe U key on the keyboard.
VThe V key on the keyboard.
WThe W key on the keyboard.
XThe X key on the keyboard.
YThe Y key on the keyboard.
ZThe Z key on the keyboard.
LeftCurlyBracketRepresents the left curly brace key { on the keyboard.
PipeRepresents the pipe character
RightCurlyBracketRepresents the right curly brace key on the keyboard, { key.
TildeRepresents the tilde (~) key on the keyboard.
DeleteRepresents the delete key on the keyboard.
Keypad0Represents the numeric keypad 0 key on the keyboard.
Keypad1Represents the number key 1 on the keyboard.
Keypad2Represents the number key 2 on the keyboard.
Keypad3Represents the number key 3 on the keyboard.
Keypad4Represents the number 4 key on the keyboard.
Keypad5Represents the number key 5 on the keyboard.
Keypad6Represents the number key 6 on the keyboard.
Keypad7Represents the number 7 key on the keyboard's numeric keypad.
Keypad8Represents the number 8 key on the keyboard's numeric keypad.
Keypad9Represents the number 9 key on the keyboard's numeric keypad.
KeypadPeriodRepresents the decimal point "." key on the numeric keypad of the keyboard.
KeypadDivideRepresents the numeric keypad on the keyboard, excluding the / key.
KeypadMultiplyRepresents the multiplication (*) key on the numeric keypad of the keyboard.
KeypadMinusRepresents the minus (-) key on the numeric keypad of the keyboard.
KeypadPlusRepresents the plus (+) key on the numeric keypad of the keyboard.
KeypadEnterRepresents the enter key on the numeric keypad of the keyboard.
KeypadEqualsRepresents the equals = key on the numeric keypad of the keyboard.
UpArrowRepresents the upward arrow key on the keyboard.
DownArrowRepresents the down arrow key on the keyboard.
RightArrowRepresents the right arrow key on the keyboard.
LeftArrowRepresents the left arrow key on the keyboard.
InsertRepresents the Insert key on the keyboard.
HomeRepresents the Home key on the keyboard.
EndRepresents the end key on the keyboard.
PageUpRepresents the Page Up key on the keyboard.
PageDownRepresents the Page Down key on the keyboard.
F1Represents the F1 key on the keyboard.
F2Represents the F2 key on the keyboard.
F3Represents the F3 key on the keyboard.
F4Represents the F4 key on the keyboard.
F5Represents the F5 key on the keyboard.
F6Represents the F6 key on the keyboard.
F7Represents the F7 key on the keyboard.
F8Represents the F8 key on the keyboard.
F9Represents the F9 key on the keyboard.
F10Represents the F10 key on the keyboard.
F11Represents the F11 key on the keyboard.
F12Represents the F12 key on the keyboard.
F13Represents the F13 key on the keyboard.
F14Represents the F14 key on the keyboard.
F15Represents the F15 key on the keyboard.
NumlockRepresents the Num Lock key on the keyboard.
CapsLockRepresents the Caps Lock key on the keyboard.
ScrollLockRepresents the Scroll Lock key on the keyboard.
RightShiftRepresents the right Shift key on the keyboard.
LeftShiftRepresents the left Shift key on the keyboard.
RightControlRepresents the right Ctrl key on the keyboard.
LeftControlRepresents the left Ctrl key on the keyboard.
RightAltRepresents the right Alt key on the keyboard.
LeftAltRepresents the left Alt key on the keyboard.
RightCommandRepresents the right Command key on the keyboard.
RightAppleRepresents the right Apple key on the keyboard.
LeftCommandRepresents the left Command key on a Mac keyboard.
LeftAppleRepresents the Apple key.
LeftWindowsRepresents the left Windows key on the keyboard.
RightWindowsRepresents the right Windows key on the keyboard.
AltGrThe right Alt key.
HelpRepresents the Help key on the keyboard.
PrintRepresents the Print Screen key on the keyboard.
SysReqRepresents the SysReq key on the keyboard.
BreakRepresents the Pause/Break key on the keyboard.
MenuRepresents the menu key on the keyboard or device.
Mouse0Mouse left button.
Mouse1Mouse right button.
Mouse2Middle mouse button.
Mouse3The fourth mouse button.
Mouse4The fifth mouse button.
Mouse5The sixth mouse button.
Mouse6The seventh mouse button.
JoystickButton0Represents button 0 on the gamepad.
JoystickButton1Represents button 1 on a gamepad.
JoystickButton2Represents button 2 on a gamepad.
JoystickButton3Represents button 3 on a gamepad.
JoystickButton4Represents button 4 on a gamepad.
JoystickButton5Represents button 5 on a gamepad.
JoystickButton6Represents button 6 on a gamepad.
JoystickButton7Represents button 7 on a gamepad.
JoystickButton8Represents button 8 on a gamepad.
JoystickButton9Represents button 9 on the gamepad.
JoystickButton10Represents button 10 on a gamepad.
JoystickButton11Represents button 11 on the gamepad.
JoystickButton12Represents button 12 on a gamepad.
JoystickButton13Represents button 13 on a gamepad.
JoystickButton14Represents button 14 on a gamepad.
JoystickButton15Represents button 15 on a gamepad.
JoystickButton16Represents button 16 on a gamepad.
JoystickButton17Represents button 17 on a gamepad.
JoystickButton18Represents button 18 on a gamepad.
JoystickButton19Represents button 19 on a gamepad.
Joystick1Button0Represents the 1st button of a gamepad.
Joystick1Button1Represents the second button on a gamepad.
Joystick1Button2Represents the 3rd button on a gamepad.
Joystick1Button3Represents the 4th button on a gamepad.
Joystick1Button4Represents the 5th button on a gamepad.
Joystick1Button5Represents the 6th button on a gamepad.
Joystick1Button6Represents the 7th button on a gamepad.
Joystick1Button7Represents the 8th button on a gamepad.
Joystick1Button8Represents the 9th button on a gamepad.
Joystick1Button9Represents the 10th button on a gamepad.
Joystick1Button10Represents the 11th button on a gamepad.
Joystick1Button11Represents the 12th button on a gamepad.
Joystick1Button12Represents the 13th button on a gamepad.
Joystick1Button13Represents the 14th button on a gamepad.
Joystick1Button14Represents the 15th button on a gamepad.
Joystick1Button15Represents the 16th button of a gamepad.
Joystick1Button16Represents the 17th button on a gamepad.
Joystick1Button17Represents the 18th button on a gamepad.
Joystick1Button18Represents the 19th button on a gamepad.
Joystick1Button19Represents the 20th button on a gamepad.
Joystick2Button0Button 1 of the second gamepad.
Joystick2Button1Button 2 of the second gamepad.
Joystick2Button2Button 3 of the second gamepad.
Joystick2Button3The 4th button of the second gamepad.
Joystick2Button4Button 5 of the second gamepad.
Joystick2Button5Button 6 of the second gamepad.
Joystick2Button6Button 7 of the second gamepad.
Joystick2Button7Button 8 of the second gamepad.
Joystick2Button8The 9th button of the second gamepad.
Joystick2Button9The 10th button of the second gamepad.
Joystick2Button10The 11th button of the second gamepad.
Joystick2Button11The 12th button of the second gamepad.
Joystick2Button12Button 13 of the second gamepad.
Joystick2Button13Button 14 of the second gamepad.
Joystick2Button14Button 15 of the second gamepad.
Joystick2Button15The 16th button of the second gamepad.
Joystick2Button16Button 17 of the second gamepad.
Joystick2Button17Button 18 of the second gamepad.
Joystick2Button18Button 19 of the second gamepad.
Joystick2Button19Button 20 of the second gamepad.
Joystick3Button0Button 1 of the third gamepad.
Joystick3Button1Button 2 of the third game controller.
Joystick3Button2The 3rd button on the third game controller.
Joystick3Button3The 4th button on the third game controller.
Joystick3Button4The 5th button on the third game controller.
Joystick3Button5The 6th button on the third game controller.
Joystick3Button6Button 7 of the third gamepad.
Joystick3Button7The 8th button of the third game controller.
Joystick3Button8Button 9 of the third gamepad.
Joystick3Button9Button 10 of the third gamepad.
Joystick3Button10Button 11 of the third game controller.
Joystick3Button11The 12th button of the third gamepad.
Joystick3Button12The 13th button of the third gamepad.
Joystick3Button13Button 14 of the third game controller.
Joystick3Button14Button 15 of the third game controller.
Joystick3Button15The 16th button of the third gamepad.
Joystick3Button16Button 17 of the third game controller.
Joystick3Button17The 18th button on the third game controller.
Joystick3Button18Button 19 of the third game controller.
Joystick3Button19Button 20 of the third game controller.
Joystick4Button0Button 1 of the fourth gamepad.
Joystick4Button1The 2nd button of the 4th gamepad.
Joystick4Button2Button 3 of the fourth game controller.
Joystick4Button3The 4th button on the 4th gamepad.
Joystick4Button4The 5th button on the 4th gamepad.
Joystick4Button5The 6th button on the fourth gamepad.
Joystick4Button6Button 7 of the fourth gamepad.
Joystick4Button7The 8th button of the fourth gamepad.
Joystick4Button8The 9th button on the fourth gamepad.
Joystick4Button9Button 10 of the fourth gamepad.
Joystick4Button10Button 11 of the fourth gamepad.
Joystick4Button11The 12th button on the fourth gamepad.
Joystick4Button12The 13th button on the fourth gamepad.
Joystick4Button13The 14th button of the fourth gamepad.
Joystick4Button14The 15th button of the fourth gamepad.
Joystick4Button15The 16th button of the fourth gamepad.
Joystick4Button16Button 17 of the fourth gamepad.
Joystick4Button17The 18th button of the fourth gamepad.
Joystick4Button18Button 19 of the fourth gamepad.
Joystick4Button19The 20th button on the fourth gamepad.
Joystick5Button0Button 1 of the fifth game controller.
Joystick5Button1Button 2 of the fifth game controller.
Joystick5Button2Button 3 of the fifth game controller.
Joystick5Button3The 4th button on the 5th game controller.
Joystick5Button4The 5th button on the 5th game controller.
Joystick5Button5Button 6 of the fifth game controller.
Joystick5Button6Button 7 of the fifth game controller.
Joystick5Button7The 8th button of the 5th gamepad.
Joystick5Button8Button 9 of the fifth game controller.
Joystick5Button9Button 10 of the fifth gamepad.
Joystick5Button10Button 11 of the fifth game controller.
Joystick5Button11The 12th button of the fifth gamepad.
Joystick5Button12Button 13 of the fifth gamepad.
Joystick5Button13The 14th button of the fifth gamepad.
Joystick5Button14Button 15 of the fifth game controller.
Joystick5Button15The 16th button of the fifth gamepad.
Joystick5Button16Button 17 of the fifth game controller.
Joystick5Button17The 18th button of the fifth game controller.
Joystick5Button18Button 19 of the fifth game controller.
Joystick5Button19Button 20 of the fifth game controller.
Joystick6Button0Button 1 of the sixth game controller.
Joystick6Button1The 2nd button of the 6th gamepad.
Joystick6Button2The 3rd button on the 6th game controller.
Joystick6Button3The 4th button on the 6th game controller.
Joystick6Button4The 5th button on the 6th game controller.
Joystick6Button5The 6th button of the 6th gamepad.
Joystick6Button6Button 7 of the sixth gamepad.
Joystick6Button7The 8th button of the 6th gamepad.
Joystick6Button8The 9th button on the 6th gamepad.
Joystick6Button9Button 10 of the sixth game controller.
Joystick6Button10The 11th button on the 6th game controller.
Joystick6Button11The 12th button on the 6th game controller.
Joystick6Button12The 13th button on the sixth gamepad.
Joystick6Button13The 14th button on the sixth game controller.
Joystick6Button14The 15th button on the sixth game controller.
Joystick6Button15The 16th button of the sixth gamepad.
Joystick6Button16Button 17 of the sixth game controller.
Joystick6Button17The 18th button of the sixth gamepad.
Joystick6Button18Button 19 of the sixth game controller.
Joystick6Button19The 20th button of the sixth game controller.
Joystick7Button0Button 1 of the seventh game controller.
Joystick7Button1The 2nd button on the 7th game controller.
Joystick7Button2The 3rd button on the 7th game controller.
Joystick7Button3The 4th button on the 7th game controller.
Joystick7Button4The 5th button on the 7th game controller.
Joystick7Button5The 6th button on the 7th game controller.
Joystick7Button6The 7th button on the 7th game controller.
Joystick7Button7The 8th button of the 7th gamepad.
Joystick7Button8The 9th button on the 7th game controller.
Joystick7Button9The 10th button on the 7th game controller.
Joystick7Button10Button 11 of the seventh game controller.
Joystick7Button11The 12th button on the seventh game controller.
Joystick7Button12The 13th button on the seventh game controller.
Joystick7Button13The 14th button on the seventh game controller.
Joystick7Button14The 15th button on the seventh game controller.
Joystick7Button15The 16th button of the seventh game controller.
Joystick7Button16Button 17 of the seventh game controller.
Joystick7Button17The 18th button on the seventh game controller.
Joystick7Button18The 19th button on the seventh game controller.
Joystick7Button19The 20th button of the seventh game controller.
Joystick8Button0Button 1 of the eighth gamepad.
Joystick8Button1The 2nd button of the 8th gamepad.
Joystick8Button2The 3rd button on the 8th game controller.
Joystick8Button3The 4th button on the 8th game controller.
Joystick8Button4The 5th button on the 8th game controller.
Joystick8Button5The 6th button on the 8th game controller.
Joystick8Button6Button 7 of the eighth game controller.
Joystick8Button7The 8th button of the 8th gamepad.
Joystick8Button8The 9th button on the 8th game controller.
Joystick8Button9The 10th button of the 8th game controller.
Joystick8Button10The 11th button of the eighth gamepad.
Joystick8Button11The 12th button on the eighth game controller.
Joystick8Button12The 13th button of the eighth game controller.
Joystick8Button13The 14th button of the eighth gamepad.
Joystick8Button14The 15th button on the eighth game controller.
Joystick8Button15The 16th button of the eighth gamepad.
Joystick8Button16The 17th button on the eighth game controller.
Joystick8Button17The 18th button on the eighth game controller.
Joystick8Button18The 19th button on the eighth game controller.
Joystick8Button19The 20th button of the eighth game controller.