Command WAIT Foundation

Waits for a keystroke or until a character appears in the keyboard buffer.

WAIT [<SayExpression>] [TO <VarName>]
<SayExpression> can be optionally specified. The expression can be a value of data type character, numeric, date or logical. This expression is displayed prior to waiting for the keypress. If this argument is not included, a default message is displayed which depends on the country specific version of Xbase++.
<VarName> specifies the variable into which the input character is placed. If the variable is not declared, a PRIVATE variable with this name is created.

The command WAIT allows input of a single character via the keyboard and assigns the character to a variable. It is a simple input routine which first outputs the control characters Carriage-Return Line-Feed (Chr(13)+Chr(10)) so that the cursor appears at the beginning of the next screen row. <SayExpression> is then displayed and the command waits for a keypress or reads the next character from the keyboard buffer.

WAIT is a command which exists only for compatibility reasons. Instead of WAIT, a pause condition using Inkey(0) should be created. The key pressed can then be retrieved using LastKey(). The command @...SAY can be used for output of the message.

// The example shows various ways to call the 
// command WAIT. 

   LOCAL cKey 

   WAIT "Press key..." TO cKey 
   WAIT ""             TO cKey 

   WAIT 12345          TO cKey 

   WAIT Date()         TO cKey 

   WAIT .T.            TO cKey 

   WAIT TO cKey 


If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.