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

# TKeyRecord

Key event decoding type.

## Declaration

Source position: keybrdh.inc line 23

`type TKeyRecord = packed record`
`KeyCode: Word;` |  | Key code
`ShiftState: Byte;` |  | State of shift keys
`Flags: Byte;` |  | Additional flags
`end;`

## Description

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

kbdscancode |  | Keyboard scan codes
TKeyEvent |  | Base type to describe all key events.

Documentation generated on: Feb 26 2014