[Overview][Constants][Types][Procedures and functions][Index] Reference for unit 'keyboard' (#rtl)


Key event decoding type.


Source position: keybrdh.inc line 22

type TKeyRecord = packed record

  Flags: Byte;


Additional flags

  ShiftState: Byte;


State of shift keys

  KeyCode: Word;


Key code



The structure of a TKeyRecord structure is explained in the following table:

Structure of TKeyRecord
Field Meaning
KeyCode Depending on flags either the physical representation of a key (under DOS scancode, ascii code pair), or the translated ASCII/unicode character.
ShiftState Shift-state when this key was pressed (or shortly after)
Flags Determine how to interpret KeyCode

The shift-state can be checked using the various shift-state constants, and the flags in the last byte can be checked using one of the kbASCII, kbUniCode, kbFnKey, kbPhys, kbReleased constants.

If there are two keys returning the same char-code, there's no way to find out which one was pressed (Gray+ and Simple+). If it needs to be known which was pressed, the untranslated keycodes must be used, but these are system dependent. System dependent constants may be defined to cover those, with possibily having the same name (but different value).

See also



Keyboard scan codes



Base type to describe all key events.

Documentation generated on: Mar 17 2017