wxRuby Documentation Home

Key Codes

KeyCodes are a set of an integer constants constants pertinent to key
presses. These values may be returned, for example, by methods in
KeyEvent. The possible values are the ASCII character
codes, plus those detailed below. In ruby, the ASCII character code can
be obtained by prefixing a “?” to the character:

a_key = ?a # 65

To get unicode characters from a KeyEvent, use
KeyEvent#get_unicode_key.

To identify keys, such as “backspace” or “enter”, that don’t have a
character representation, use the constants listed below:

Keycode Constants


    K_BACK    = 8
    K_TAB     = 9
    K_RETURN  = 13
    K_ESCAPE  = 27
    K_SPACE   = 32
    K_DELETE  = 127

    // These are by design not compatible with unicode characters.
    // If you want to get a unicode character from a key event use
    // Wx::KeyEvent#get_unicode_key instead.
    K_START   = 300
    K_LBUTTON
    K_RBUTTON
    K_CANCEL
    K_MBUTTON
    K_CLEAR
    K_SHIFT
    K_ALT
    K_CONTROL
    K_MENU
    K_PAUSE
    K_CAPITAL
    K_END
    K_HOME
    K_LEFT
    K_UP
    K_RIGHT
    K_DOWN
    K_SELECT
    K_PRINT
    K_EXECUTE
    K_SNAPSHOT
    K_INSERT
    K_HELP
    K_NUMPAD0
    K_NUMPAD1
    K_NUMPAD2
    K_NUMPAD3
    K_NUMPAD4
    K_NUMPAD5
    K_NUMPAD6
    K_NUMPAD7
    K_NUMPAD8
    K_NUMPAD9
    K_MULTIPLY
    K_ADD
    K_SEPARATOR
    K_SUBTRACT
    K_DECIMAL
    K_DIVIDE
    K_F1
    K_F2
    K_F3
    K_F4
    K_F5
    K_F6
    K_F7
    K_F8
    K_F9
    K_F10
    K_F11
    K_F12
    K_F13
    K_F14
    K_F15
    K_F16
    K_F17
    K_F18
    K_F19
    K_F20
    K_F21
    K_F22
    K_F23
    K_F24
    K_NUMLOCK
    K_SCROLL
    K_PAGEUP,
    K_PAGEDOWN,

    K_NUMPAD_SPACE,
    K_NUMPAD_TAB,
    K_NUMPAD_ENTER,
    K_NUMPAD_F1,
    K_NUMPAD_F2,
    K_NUMPAD_F3,
    K_NUMPAD_F4,
    K_NUMPAD_HOME,
    K_NUMPAD_LEFT,
    K_NUMPAD_UP,
    K_NUMPAD_RIGHT,
    K_NUMPAD_DOWN,
    K_NUMPAD_PAGEUP,
    K_NUMPAD_PAGEDOWN,
    K_NUMPAD_END,
    K_NUMPAD_BEGIN,
    K_NUMPAD_INSERT,
    K_NUMPAD_DELETE,
    K_NUMPAD_EQUAL,
    K_NUMPAD_MULTIPLY,
    K_NUMPAD_ADD,
    K_NUMPAD_SEPARATOR,
    K_NUMPAD_SUBTRACT,
    K_NUMPAD_DECIMAL,
    K_NUMPAD_DIVIDE,

    // the following key codes are only generated under Windows currently
    K_WINDOWS_LEFT,
    K_WINDOWS_RIGHT,
    K_WINDOWS_MENU,
    K_COMMAND,

    // Hardware-specific buttons
    K_SPECIAL1 = 193,
    K_SPECIAL2,
    K_SPECIAL3,
    K_SPECIAL4,
    K_SPECIAL5,
    K_SPECIAL6,
    K_SPECIAL7,
    K_SPECIAL8,
    K_SPECIAL9,
    K_SPECIAL10,
    K_SPECIAL11,
    K_SPECIAL12,
    K_SPECIAL13,
    K_SPECIAL14,
    K_SPECIAL15,
    K_SPECIAL16,
    K_SPECIAL17,
    K_SPECIAL18,
    K_SPECIAL19,
    K_SPECIAL20

See also:

Wx::KeyEvent, WxRuby Key Modifiers

[This page automatically generated from the Textile source at 2023-06-03 08:07:34 +0000]