Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2005-03

Bug 3543

5 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Maxim Ganetsky

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"

Best regards, Maxim

Reply by email

Thomas Schatzl
to Maxim Ganetsky

Maxim Ganetsky schrieb:
Hello,

Show quoted text 10 lines
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

Reply by email

Maxim Ganetsky
to Thomas Schatzl

Hello.

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

Reply by email

Michael Van Canneyt
to Maxim Ganetsky: Hello. Bug 3543 has been closed as unreproducable, but I can not compile this program at…
Maxim Ganetsky wrote 12 lines
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"

Yes.
It compiles on Linux, but not on the other platforms.

It is my mistake; we're going to remove the KeyPressed call from the linux version of the keyboard unit.
Assume it is not there...

Michael.

Reply by email

Michael Van Canneyt
to Thomas Schatzl: According to the unit sources there is no keypressed() function in the keyboard unit, the…
Thomas Schatzl wrote 17 lines
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.

No.
The docs are generated from the linux version of the units. That means all Linux functions are documented, so if there are additional functions (as in this case), they are documented.

So the documentation is always correct _for linux_.

Michael.

Reply by email