xHarbour Reference Documentation > Command Reference xHarbour Developers Network  

WAIT

Suspend program execution until a key is pressed.

Syntax

WAIT [<msgVar>] [TO <varName>]

Arguments

<msgExpr>
An expression returning a message to display while the program waits for user input can be specified. If omitted, the user is prompted with the default message: "Press any key to continue..."
TO <varName>
Optionally, the name of a variable to receive the pressed key as a character value can be specified. When <varName> does not exist or is not visible, it is created as a private variable.

Description

WAIT is a simple console input command that employs a wait state until the user presses a key. The command displays a message on the screen in a new line. The message can be suppressed by passing a null string ("") for <msgExpr>.

The key pressed by the user can be assigned as character value to a variable for further processing.

Note:  WAIT is a compatibility command that should be replaced with function Inkey().

Info

See also:@...GET, ACCEPT, Inkey(), INPUT, MENU TO
Category: Input commands
Source:rtl\wait.prg
LIB:xhb.lib
DLL:xhbdll.dll

Example

// The example shows how to query for a single key stroke.

   PROCEDURE Main
      ? "Program started..."
      ?
      WAIT "Press Q to QUIT, any other key to continue" TO cKey

      IF cKey $ "qQ"
         ? "Program aborted"
         QUIT
      ENDIF

      ? "Normal program termination".
   RETURN

Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe