Keyboard Support

Contact and Search Homepage

Header bottom

On this page

(image: Keyman icon)Virtual Keys

Virtual Keys

With ordinary rules, you can match any key that produces a character. However,sometimes you may want to match other keys, for example Backspace, or Ctrl- orAlt-combinations. In order to match keys like these you need to use virtual keys.Every key on the keyboard is identified by a virtual key code. Virtualkeys are identified by square brackets '[ ]' containing a combination of zero ormore shift-key codes and a virtual key code.A list of all virtual key codes canbe found in the reference section of this help file. You can also use theVirtual Key Identifier on the Tools menu in TIKE to identify a virtual key code.

Using Virtual Keys

Virtual keys are used in the key section of a rule, or in special cases in theoutput. However, virtual keys are not valid in the context of a rule, as thecontext consists solely of characters.A typical use of virtual keys is to make rules to recognise non-character keys,such as Backspace or Tab; for example:

+ [K_TAB] > "You pressed Tab"

Virtual keys are also commonly used to recognise Ctrl- or Alt-key combinations,like this:

+ [CTRL ALT K_A] > "You pressed Ctrl+Alt+A"

The valid shift-key codes are:

AltGr and Other Special Keys

The AltGr Key is common on European keyboards, where it enables the use of asecond character on some keys. A frequently asked question is how to correctlycreate a keyboard that uses AltGr-key combinations.Positionally, and physically the AltGr key is just the right-hand Alt key; withthis in mind, you can create a rule to use it like this:

+ [RALT K_A] > "You pressed AltGr+A"

If you have a European keyboard layour set up in Control Panel, you might needto enable the option "Simulate AltGr with Ctrl+Alt" for this to work correctly.This is because some European layouts convert a Right-Alt press into Ctrl+Alt.You can also enable this option to support keyboards without a right-alt key(such as many notebooks). This will allow the use of the Ctrl+Alt keycombination to simulate Right Alt.

Some keyboards, especially European keyboards, may have one or more additionalkeys. These can often only be distinguished with its virtual key codes. If youwish to use these keys in a keyboard, you must identify their key codes withthe Virtual Key Identifier (located in the Tools menu).

Virtual Keys in Output

In a few specialised situations, you may need to output virtual keys, such asCtrl- or other shifted combinations. To do this, you may specify a virtual keycode in the output of a rule. However, it is best to avoid this if possible, as virtual keys have different meanings in different applications.

Related Topics

Virtual Key Codes