qp.hlp (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
KeyPressed Function
  Summary Details Example                                   Back
 
  Returns
 
    Boolean    True if keyboard buffer contains an unread character;
               otherwise False
 
  Description
 
    The KeyPressed function immediately returns the status of the
    keyboard buffer. If a character is waiting to be read, KeyPressed
    returns True. If the buffer is empty, it returns False. KeyPressed
    leaves any waiting characters undisturbed and unread. Use the
    ReadKey function or the Read or Readln procedures to get the
    character.
 
    KeyPressed ignores shift operations. It does not return the
    keyboard status for keys such as ALT, CAPSLOCK, NUMLOCK, and SHIFT.
 
    Use KeyPressed to get the status of the keyboard buffer before
    reading a character with ReadKey:
 
       IF KeyPressed THEN ch := ReadKey;
 
    Use KeyPressed along with ReadKey to clear the keyboard buffer of
    unwanted characters before prompting for input:
 
       WHILE KeyPressed DO ch := ReadKey;
 
    Use KeyPressed to continue a loop until any key is pressed:
 
       WHILE NOT KeyPressed DO ... ;