[fpc-devel] Bug 3543

Maxim Ganetsky ganmax at narod.ru
Thu Mar 31 01:08:10 CEST 2005


On 31 March 2005, 2:29:43 Thomas wrote:

TS> According to the unit sources there is no keypressed() function in the
TS> keyboard unit, the docs are wrong (I think so at least) or it has been
TS> removed.
TS> Additionally you have to initialize the keyboard unit before using it,
TS> and deinitialize it afterwards manually, otherwise the keyboard methods
TS> won't work.

Didn't think about it yet. First I had to compile this program :))

TS> But there's a solution, I think you can simulate the keypressed function
TS> with the PollKeyEvent method as suggested in the docs:

TS> uses
TS>    keyboard;

TS> function keypressed : boolean;
TS> begin
TS>      keypressed := PollKeyEvent <> 0;
TS> end;

TS> begin
TS>      InitKeyBoard();
TS>      repeat
TS>      until keypressed;
TS>      DoneKeyBoard();
TS> end.

One can also use Crt unit.

TS> Regards,
TS>    Thomas

Thanks for help.

Best regards,
 Maxim                          mailto:ganmax at narod.ru

More information about the fpc-devel mailing list