keyboard unit
Access to low-level keyboard functions.
The Keyboard unit implements a keyboard access layer which is system
independent. It can be used to poll the keyboard state and wait for certain
events. Waiting for a keyboard event can be done with the GetKeyEvent
function, which will return a driver-dependent key event. This key event can
be translated to a interpretable event by the TranslateKeyEvent
function. The result of this function can be used in the other event
examining functions.
A custom keyboard driver can be installed using the SetKeyboardDriver function. The current keyboard driver can be retrieved using the GetKeyboardDriver function. The last section of this chapter demonstrates how to make a keyboard driver.
Classes and records
TEnhancedKeyEvent | record | |
TKeyboardDriver | record | Keyboard driver structure. |
TKeyRecord | record | Key event decoding type. |
Procedures and functions
ConvertEnhancedToLegacyShiftState | function | |
ConvertToLegacyKeyEvent | function | |
DoneKeyboard | procedure | Deactivate keyboard driver. |
equal(TEnhancedKeyEvent,TEnhancedKeyEvent):Boolean | operator | |
FunctionKeyName | function | Return string representation of a function key code. |
GetEnhancedKeyEvent | function | |
GetKeyboardDriver | procedure | Return the current keyboard driver record. |
GetKeyEvent | function | Get the next raw key event, wait if needed. |
GetKeyEventChar | function | Get the character key part of a key event. |
GetKeyEventCode | function | Translate function key part of a key event code. |
GetKeyEventFlags | function | Extract the flags from a key event. |
GetKeyEventShiftState | function | Return the current state of the shift keys. |
GetKeyEventUniCode | function | Return the Unicode key event. |
InitKeyboard | procedure | Initialize the keyboard driver. |
IsFunctionKey | function | Check whether a given event is a function key event. |
KeyEventToString | function | Return a string describing the key event. |
KeyPressed | function | Check event queue for key press. |
PollEnhancedKeyEvent | function | |
PollKeyEvent | function | Get next key event, but does not wait. |
PollShiftStateEvent | function | Check current shift state. |
PutKeyEvent | procedure | Put a key event in the event queue. |
SetKeyboardDriver | function | Set a new keyboard driver. |
ShiftStateToString | function | Return description of key event shift state. |
TranslateKeyEvent | function | Translate raw event to ascii key event. |
TranslateKeyEventUniCode | function | Translate raw event to UNICode key event. |
Types
PTreeElement | type | Pointer to TTreeElement record. |
TEnhancedShiftState | set | |
TEnhancedShiftStateElement | enumeration | |
TKeyEvent | type | Base type to describe all key events. |
Tprocedure | procedure type | Procedure prototype. |
Constants
AltPrefix | constant | Keycode for alternate prefix key for Alt key. Unix Only. |
CAPSLOCK_ON | constant | |
CtrlPrefix | constant | Keycode for alternate prefix key for Ctrl key. Unix only. |
ENHANCED_KEY | constant | |
errKbdBase | constant | Base of keyboard routine error reporting constants. |
errKbdInitError | constant | Failed to initialize keyboard driver. |
errKbdNotImplemented | constant | Keyboard driver not implemented. |
kbAlt | constant | Alt key modifier. |
kbASCII | constant | ASCII code key event. |
kbBack | constant | |
kbCtrl | constant | Control key modifier. |
kbdApps | constant | Application key (popup-menu) pressed. |
kbdDelete | constant | Delete key pressed. |
kbdDown | constant | Arrow down key pressed. |
kbdEnd | constant | End key pressed. |
kbdF1 | constant | F1 function key pressed. |
kbdF10 | constant | F10 function key pressed. |
kbdF11 | constant | F12 function key pressed. |
kbdF12 | constant | F12 function key pressed. |
kbdF13 | constant | F13 function key pressed. |
kbdF14 | constant | F14 function key pressed. |
kbdF15 | constant | F15 function key pressed. |
kbdF16 | constant | F16 function key pressed. |
kbdF17 | constant | F17 function key pressed. |
kbdF18 | constant | F18 function key pressed. |
kbdF19 | constant | F19 function key pressed. |
kbdF2 | constant | F2 function key pressed. |
kbdF20 | constant | F20 function key pressed. |
kbdF3 | constant | F3 function key pressed. |
kbdF4 | constant | F4 function key pressed. |
kbdF5 | constant | F5 function key pressed. |
kbdF6 | constant | F6 function key pressed. |
kbdF7 | constant | F7 function key pressed. |
kbdF8 | constant | F8 function key pressed. |
kbdF9 | constant | F9 function key pressed. |
kbdHome | constant | Home key pressed. |
kbdInsert | constant | Insert key pressed. |
kbdLeft | constant | Arrow left key pressed. |
kbdLWin | constant | Left windows key pressed. |
kbdMiddle | constant | Middle key pad key pressed (numerical 5). |
kbdPgDn | constant | Page down key pressed. |
kbdPgUp | constant | Page Up key pressed. |
kbdRight | constant | Arrow right key pressed. |
kbdRWin | constant | Right windows key pressed. |
kbdUp | constant | Arrow up key pressed. |
kbEnter | constant | |
kbFnKey | constant | function key pressed. |
kbLeftShift | constant | Left shift key modifier. |
kbPhys | constant | Physical key code event. |
kbReleased | constant | Key release event (not implemented in FPC). |
kbRightShift | constant | Right shift key modifier. |
kbShift | constant | Shift key modifier. |
kbSpaceBar | constant | |
kbTab | constant | |
kbUniCode | constant | Unicode code key event. |
LEFT_ALT_PRESSED | constant | |
LEFT_CTRL_PRESSED | constant | |
NilEnhancedKeyEvent | constant | |
NUMLOCK_ON | constant | |
RIGHT_ALT_PRESSED | constant | |
RIGHT_CTRL_PRESSED | constant | |
SAnd | constant | 'And' description string. |
SCROLLLOCK_ON | constant | |
SHIFT_PRESSED | constant | |
ShiftPrefix | constant | Keycode for alternate prefix key for Shift key. Unix Only. |
SKeyPad | constant | Names of keypad keys. |
SLeftRight | constant | Names for left-right keys. |
SScanCode | constant | Scancode key. |
SShift | constant | Names of modifier keys. |
SUnicodeChar | constant | Unicode character string. |
SUnknownFunctionKey | constant | Unknown function key. |
Topics
kbddriver | topic | Writing a keyboard driver. |
kbdscancode | topic | Keyboard scan codes. |
kbdunix | topic | Unix specific notes. |
An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
