[Overview][Constants][Types][Procedures and functions][Index] |
Get the next raw key event, wait if needed.
Source position: keybrdh.inc line 143
function GetKeyEvent: TKeyEvent; |
GetKeyEvent returns the last keyevent if it is available, or waits for one if none is available. A non-blocking version is available in PollKeyEvent.
The returned key is encoded as a TKeyEvent type variable, and is normally the physical key scan code, (the scan code is driver dependent) which can be translated with one of the translation functions TranslateKeyEvent or TranslateKeyEventUniCode. See the types section for a description of how the key is described.
If no key became available (e.g. when the driver does not support it), 0 is returned.
|
Put a key event in the event queue. |
|
|
Get next key event, but does not wait. |
|
|
Translate raw event to ascii key event |
|
|
Translate raw event to UNICode key event |
program example1; { This program demonstrates the GetKeyEvent function } uses keyboard; Var K : TKeyEvent; begin InitKeyBoard; Writeln('Press keys, press "q" to end.'); Repeat K:=GetKeyEvent; K:=TranslateKeyEvent(K); Write('Got key event with '); Case GetKeyEventFlags(K) of kbASCII : Writeln('ASCII key'); kbUniCode : Writeln('Unicode key'); kbFnKey : Writeln('Function key'); kbPhys : Writeln('Physical key'); kbReleased : Writeln('Released key event'); end; Writeln('Got key : ',KeyEventToString(K)); Until (GetKeyEventChar(K)='q'); DoneKeyBoard; end.
lazarus-ccr.sourceforge.net |