KeyPressed

From Delphi Pascal wiki
Jump to navigation Jump to search

Determines if a key has been pressed on the keyboard.


Declaration
function KeyPressed: Boolean;
Target
Windows, Real, Protected
Remarks
The key can be read using the ReadKey function.
Return Value
True If key has been pressed False If key has not been pressed.


Sample Code
{KeyPress.PAS}
{Sample code for the KeyPressed function.}

{ For Windows: }
{ uses WinCrt; }

uses Crt;
begin
 repeat
   Write('Xx');
 until KeyPressed;
end.