[fpc-pascal]readkey return
Arne Hanssen
arne-h at c2i.net
Tue Sep 25 20:00:35 CEST 2001
Thus spoke Lee, John (LeeJ at logica.com):
> { Program to demonstrate the ReadKey function. }
>
> var
> ch : char;
> begin
> writeln('Press Left/Right, Esc=Quit');
> repeat
> ch:=ReadKey;
> case ch of
> #0 : begin
> ch:=ReadKey; {Read ScanCode}
> case ch of
> #75 : WriteLn('Left');
> #77 : WriteLn('Right');
> end;
> end;
> #27 : WriteLn('ESC');
> end;
> until ch=#27 {Esc}
> end.
You might want to escape #224 also as this code prefixes some
special keys (to keep numpad-Home and Home apart or something
like that as I remember it - the PC keyboard is somewhat messy!).
--
Vennlig hilsen / Best regards |\ ___,,--, _
Arne Hanssen, Senja, Norway /,`--'' \-,,__,'/
http://home.c2i.net/nite |,4 ) )_ ) /~-----'
http://home.c2i.net/bkgras -----'---^~(_/-_)--(_/_)-------
More information about the fpc-pascal
mailing list