mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-05-16 13:02:48 +02:00
28 lines
636 B
ObjectPascal
28 lines
636 B
ObjectPascal
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;
|
|
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;
|
|
K:=TranslateKeyEvent(K);
|
|
Writeln('Got key : ',KeyEventToString(K));
|
|
Until (GetKeyEventChar(K)='q');
|
|
DoneKeyBoard;
|
|
end.
|