KeyCodes
Jump to navigation
Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
A few words on keycodes
When you want to handle the KeyDown event, you get passed a wxKeyEvent event as a parameter. event.GetKeyCode() will then return you the KeyCode of the pressed key. This page aims to upgrade the documentation for wxWidgets 2.4.2. The documentation in 2.6.3 is more complete.
A few oddities
The way it works seems a little strange sometimes (at least on Windows XP). For example :
- right control and left control cannot be differentiated,
- the keycode of non special keys is an ascii code, which means it will depend on the keyboard layout you are using,
- "print screen" will not generate an event on my system,
- the right alt key will send me two events instead of only one ( WXK_CONTROL and WXK_ALT ).
The french keyboard layout
As I am using a french layout, here are the values I get. Keep in mind it will be different from a US keyboard layout (or any other layout). I have listed the keys from left to right and from up to down :
- NK_ESC 27
- NK_F1 342
- NK_F2 343
- NK_F3 344
- NK_F4 345
- NK_F5 346
- NK_F6 347
- NK_F7 348
- NK_F8 349
- NK_F9 350
- NK_F10 351
- NK_F11 352
- NK_F12 353
- NK_SYSREQ
- NK_SCRLOCK 367
- NK_PAUSE 310
- NK_GRAVE 39
- NK_1 49
- NK_2 50
- NK_3 51
- NK_4 52
- NK_5 53
- NK_6 54
- NK_7 55
- NK_8 56
- NK_9 57
- NK_0 48
- NK_MINUS 91
- NK_EQUAL 43
- NK_BACKSPACE 8
- NK_INSERT 324
- NK_HOME 315
- NK_PAGEUP 312
- NK_PAD_LOCK 366
- NK_PAD_SLASH 396
- NK_PAD_ASTERIS 391
- NK_PAD_MINUS 394
- NK_TAB 9
- NK_Q 81
- NK_W 87
- NK_E 69
- NK_R 82
- NK_T 84
- NK_Y 89
- NK_U 85
- NK_I 73
- NK_O 79
- NK_P 80
- NK_LBRACKET 93
- NK_RBRACKET 59
- NK_ENTER 13
- NK_DELETE 127
- NK_END 314
- NK_PAGEDOWN 313
- NK_PAD_7 315
- NK_PAD_8 317
- NK_PAD_9 312
- NK_PAD_PLUS 392
- NK_CAPSLOCK 311
- NK_A 65
- NK_S 83
- NK_D 68
- NK_F 70
- NK_G 71
- NK_H 72
- NK_J 74
- NK_K 75
- NK_L 76
- NK_SEMICOLON 44
- NK_APOSTROPHE 126
- NK_NUMBERSIGN 92
- NK_PAD_4 316
- NK_PAD_5 305
- NK_PAD_6 318
- NK_LSHIFT 306
- NK_BACKSLASH 226
- NK_Z 90
- NK_X 88
- NK_C 67
- NK_V 86
- NK_B 66
- NK_N 78
- NK_M 77
- NK_COMMA 46
- NK_PERIOD 47
- NK_SLASH 223
- NK_RSHIFT 306
- NK_UP 317
- NK_PAD_1 314
- NK_PAD_2 319
- NK_PAD_3 313
- NK_PAD_ENTER 13
- NK_LCTRL 308
- NK_LALT 309
- NK_SPACE 32
- NK_RALT 308+309
- NK_RCTRL 308
- NK_LEFT 316
- NK_DOWN 319
- NK_RIGHT 318
- NK_PAD_0 324
- NK_PAD_PERIOD 127
- NK_LMETA 91
- NK_RMETA 92
- NK_MENU 93