Skip to content

TKeyRecord

Key event decoding type.

Declaration

Source position: keybrdh.inc line 22

Type
TKeyRecord = packed record
  Flags : Byte;
  ShiftState : Byte;
  KeyCode : Word;
end

Description

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

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 possibly having the same name (but different value).

See also

Name Description
Byte An unsigned 8-bits integer
Byte An unsigned 8-bits integer
kbdscancode Keyboard scan codes
TKeyEvent Base type to describe all key events.
Word An unsigned 16-bits integer