[fpc-devel] Bug 3543
Thomas Schatzl
tom_at_work at gmx.at
Thu Mar 31 00:29:43 CEST 2005
Maxim Ganetsky schrieb:
Hello,
> Bug 3543 has been closed as unreproducable, but I can not
> compile this program at least with fpc 1.9.8 on Win32:
>
> Uses Keyboard;
> begin
> repeat
> until KeyPressed;
> end.
>
> Error: Identifier not found "KeyPressed"
According to the unit sources there is no keypressed() function in the
keyboard unit, the docs are wrong (I think so at least) or it has been
removed.
Additionally you have to initialize the keyboard unit before using it,
and deinitialize it afterwards manually, otherwise the keyboard methods
won't work.
But there's a solution, I think you can simulate the keypressed function
with the PollKeyEvent method as suggested in the docs:
uses
keyboard;
function keypressed : boolean;
begin
keypressed := PollKeyEvent <> 0;
end;
begin
InitKeyBoard();
repeat
until keypressed;
DoneKeyBoard();
end.
Regards,
Thomas
More information about the fpc-devel
mailing list