Keyboard Support

Contact and Search

Keyman.com Homepage

Header bottom

Keyman.com

Other versions
Version 6.0

On this page

Virtual Keys and Virtual Character Keys

Virtual keys provide a mechanism for recognising any key combination on the keyboard. Any key that does not normally generate a character, except for a few listed below, can be matched by this technique.

The key codes refer to the actual key at the given position on a standard US-English keyboard. When used with a non US-English keyboard driver (selected through Control Panel/Keyboards), differences can arise, and this use is not recommended.

The Right-Alt key has traditionally been used on European keyboards as an additional shift state, usually known as AltGr. The end user of Keyman keyboards can select an option to emulate Right-Alt with Ctrl+Alt, as Right-Alt is not available on many notebook keyboards. Thus, it is wise to avoid using Ctrl+Alt combinations in the same keyboard as Right-Alt combinations.

Additionally, it is useful to keep in mind that when this emulation is active, it is not possible to recognise the Ctrl+Right Alt combination, as this is overridden by Ctrl+Alt (producing Right-Alt). This can have ramifications in keyboards such as German, which makes use of the Ctrl+AltGr combination.

Virtual Keys vs Virtual Character Keys: Keyman 6.0 introduced a new feature known as mnemonic layouts. This feature requires that the "white" alphabet/numeric/punctuation keys in the primary section of the keyboard are referenced by the character on the key cap rather than the key position (as with non-mnemonic layouts). However, all other keys on the keyboard should be referenced as normal.

It is important to remember that you can choose any character that appears on a given keycap, not just the unshifted character. For instance, if you use ['A'], you will be matching the unshifted A key; you must still explicitly state the shift state for the key.

Reference

The general format for a virtual character key is:

[ shift-codes 'c' ]

where c is any character on the keyboard.

The general format for a virtual key is:

[ shift-codes K_key ]

The possible shift codes are:

Shift CodeMeaning
SHIFTEither shift key
CTRLEither control key
ALTEither alt key
LCTRLLeft control key
RCTRLRight control key (not found on all keyboards)
LALTLeft alt key
RALTRight alt key or AltGr on European keyboards (not found on all keyboards)
CAPSCaps Lock is on
NCAPSCaps Lock is off

A caveat for using RALT: When using many European keyboards, Windows internally translates the RALT (or AltGr) key to LCTRL+RALT. Keyman also includes an option to treat CTRL+ALT in the same manner as RALT (this is useful for notebook keyboards that do not have a RALT or AltGr key. Both of these 'features' mean that you should avoid using more than one of the following shift combinations in the same keyboard:

Shift Code
RALT
CTRL ALT
CTRL RALT
LCTRL ALT
LCTRL RALT

The following table lists all of the common virtual key codes:

Key CodeKey Name  Key CodeKey Name
K_SPACESpacebar K_oE2102nd Key (European)
K_AA K_BKSPBackspace
K_BB K_TABTab
K_CC K_ENTEREnter
K_DD K_ESCEscape
K_EE K_LEFTLeft Arrow
K_FF K_UPUp Arrow
K_GG K_RIGHTRight Arrow
K_HH K_DOWNDown Arrow
K_II K_PGUPPage Up
K_JJ K_PGDNPage Down
K_KK K_HOMEHome
K_LL K_ENDEnd
K_MM K_INSInsert
K_NN K_DELDelete
K_OO K_F1F1
K_PP K_F2F2
K_QQ K_F3F3
K_RR K_F4F4
K_SS K_F5F5
K_TT K_F6F6
K_UU K_F7F7
K_VV K_F8F8
K_WW K_F9F9
K_XX K_F10F10
K_YY K_F11F11
K_ZZ K_F12F12
K_11 K_KP5Key Pad 5 (Numlock off)
K_22 K_NP0Number Pad 0
K_33 K_NP1Number Pad 1
K_44 K_NP2Number Pad 2
K_55 K_NP3Number Pad 3
K_66 K_NP4Number Pad 4
K_77 K_NP5Number Pad 5
K_88 K_NP6Number Pad 6
K_99 K_NP7Number Pad 7
K_00 K_NP8Number Pad 8
K_BKQUOTE` K_NP9Number Pad 9
K_HYPHEN- K_NPSTARNumber Pad *
K_EQUAL= K_NPPLUSNumber Pad +
K_LBRKT[ K_NPMINUSNumber Pad -
K_RBRKT] K_NPDOTNumber Pad .
K_BKSLASH\ K_NPSLASHNumber Pad /
K_COLON;
K_QUOTE'
K_COMMA,
K_PERIOD.
K_SLASH/

The following table lists all of the less common virtual key codes:

Key CodeKey Name  Key CodeKey Name
K_SELSelect K_?96Unknown Key 96
K_PRINTPrint K_?97Unknown Key 97
K_EXECExecute K_?98Unknown Key 98
K_HELPHelp K_?99Unknown Key 99
K_SEPARATORSeparator K_?9AUnknown Key 9A
K_F13F13 K_?9BUnknown Key 9B
K_F14F14 K_?9CUnknown Key 9C
K_F15F15 K_?9DUnknown Key 9D
K_F16F16 K_?9EUnknown Key 9E
K_F17F17 K_?9FUnknown Key 9F
K_F18F18 K_?A0Unknown Key A0
K_F19F19 K_?A1Unknown Key A1
K_F20F20 K_?A2Unknown Key A2
K_F21F21 K_?A3Unknown Key A3
K_F22F22 K_?A4Unknown Key A4
K_F23F23 K_?A5Unknown Key A5
K_F24F24 K_?A6Unknown Key A6
K_KANJI?15Kanji Key #1 K_?A7Unknown Key A7
K_KANJI?16Kanji Key #2 K_?A8Unknown Key A8
K_KANJI?17Kanji Key #3 K_?A9Unknown Key A9
K_KANJI?18Kanji Key #4 K_?AAUnknown Key AA
K_KANJI?19Kanji Key #5 K_?ABUnknown Key AB
K_KANJI?1CKanji Key #6 K_?ACUnknown Key AC
K_KANJI?1DKanji Key #7 K_?ADUnknown Key AD
K_KANJI?1EKanji Key #8 K_?AEUnknown Key AE
K_KANJI?1FKanji Key #9 K_?AFUnknown Key AF
K_oE0OEM Key E0 K_?B0Unknown Key B0
K_oE1OEM Key E1 K_?B1Unknown Key B1
K_oE3OEM Key E3 K_?B2Unknown Key B2
K_oE4OEM Key E4 K_?B3Unknown Key B3
K_oE6OEM Key E6 K_?B4Unknown Key B4
K_oE9OEM Key E9 K_?B5Unknown Key B5
K_oEAOEM Key EA K_?B6Unknown Key B6
K_oEBOEM Key EB K_?B7Unknown Key B7
K_oECOEM Key EC K_?B8Unknown Key B8
K_oEDOEM Key ED K_?B9Unknown Key B9
K_oEEOEM Key EE K_?C1Unknown Key C1
K_oEFOEM Key EF K_?C2Unknown Key C2
K_oF0OEM Key F0 K_?C3Unknown Key C3
K_oF1OEM Key F1 K_?C4Unknown Key C4
K_oF2OEM Key F2 K_?C5Unknown Key C5
K_oF3OEM Key F3 K_?C6Unknown Key C6
K_oF4OEM Key F4 K_?C7Unknown Key C7
K_oF5OEM Key F5 K_?C8Unknown Key C8
K_?00Unknown Key 00 K_?C9Unknown Key C9
K_?05Unknown Key 05 K_?CAUnknown Key CA
K_?06Unknown Key 06 K_?CBUnknown Key CB
K_?07Unknown Key 07 K_?CCUnknown Key CC
K_?0AUnknown Key 0A K_?CDUnknown Key CD
K_?0BUnknown Key 0B K_?CEUnknown Key CE
K_?0EUnknown Key 0E K_?CFUnknown Key CF
K_?0FUnknown Key 0F K_?D0Unknown Key D0
K_?1AUnknown Key 1A K_?D1Unknown Key D1
K_?3AUnknown Key 3A K_?D2Unknown Key D2
K_?3BUnknown Key 3B K_?D3Unknown Key D3
K_?3CUnknown Key 3C K_?D4Unknown Key D4
K_?3DUnknown Key 3D K_?D5Unknown Key D5
K_?3EUnknown Key 3E K_?D6Unknown Key D6
K_?3FUnknown Key 3F K_?D7Unknown Key D7
K_?40Unknown Key 40 K_?D8Unknown Key D8
K_?5BUnknown Key 5B K_?D9Unknown Key D9
K_?5CUnknown Key 5C K_?DAUnknown Key DA
K_?5DUnknown Key 5D K_oDFUnknown Key DF
K_?5EUnknown Key 5E K_?E5Unknown Key E5
K_?5FUnknown Key 5F K_?E7Unknown Key E7
K_?88Unknown Key 88 K_?E8Unknown Key E8
K_?89Unknown Key 89 K_?F6Unknown Key F6
K_?8AUnknown Key 8A K_?F7Unknown Key F7
K_?8BUnknown Key 8B K_?F8Unknown Key F8
K_?8CUnknown Key 8C K_?F9Unknown Key F9
K_?8DUnknown Key 8D K_?FAUnknown Key FA
K_?8EUnknown Key 8E K_?FBUnknown Key FB
K_?8FUnknown Key 8F K_?FCUnknown Key FC
K_?92Unknown Key 92 K_?FDUnknown Key FD
K_?93Unknown Key 93 K_?FEUnknown Key FE
K_?94Unknown Key 94 K_?FFUnknown Key FF
K_?95Unknown Key 95

The following table lists all of the reserved virtual key codes that will not be recognised even if they are on your keyboard, although they are included in Keyman for completeness:

Key CodeKey name
K_SHIFTShift
K_CONTROLControl
K_ALTAlt
K_CAPSCaps Lock
K_NUMLOCKNum Lock
K_SCROLLScroll Lock
K_LBUTTONLeft Mouse Button
K_MBUTTONMiddle Mouse Button
K_RBUTTONRight Mouse Button
K_CANCELCtrl+Break
K_PAUSEPause
K_PRTSCNPrint Screen

Some examples are:


Virtual keys also work in the output (sending keystrokes to an application), but they are not officially supported and may not work in all circumstances.