WAIT Command

See Also

Displays a message and pauses Microsoft Visual FoxPro execution until the user presses a key or click the mouse.

Syntax

WAIT
  [cMessageText]
  [TO VarName]
  [WINDOW [AT nRow, nColumn]]
  [NOWAIT]
  [CLEAR | NOCLEAR]
  [TIMEOUT nSeconds]

Arguments

cMessageText

Specifies a custom message to display. If you omit cMessageText, Visual FoxPro displays the default message. If cMessageText is an empty string (""), a message isn't displayed and Visual FoxPro waits until a key is pressed before continuing program execution.

TO VarName

Saves the key pressed to a variable or an array element. If the variable or an array element you specify with VarName doesn't exist, it is created. The empty string is stored in VarName if you press ENTER or a nonprintable key or key combination, or click the mouse.

WINDOW

Displays the message in a system message window located in the upper-right corner of the main Visual FoxPro window. The window can be temporarily hidden by pressing the CTRL or SHIFT key.

AT nRow, nColumn

In Visual FoxPro, specifies the position of the message window on the screen.

NOWAIT

Continues program execution immediately after the message is displayed. The program doesn't wait for the message to be removed from the main Visual FoxPro window, but continues executing on the program line immediately following the program line containing WAIT NOWAIT. If you omit NOWAIT, program execution pauses until the message is removed from the main Visual FoxPro window by pressing a key or clicking the mouse.

CLEAR

Removes a Visual FoxPro system window or a WAIT message window from the main Visual FoxPro window from within a program. For example, talk from indexing, sorting, and so on is directed to a Visual FoxPro system window if you issue SET TALK WINDOW. The window can be removed interactively if you press a key or move the mouse. Issue WAIT CLEAR to remove the window from within a program.

NOCLEAR

Specifies that a WAIT message window remains on the main Visual FoxPro window until WAIT CLEAR or another WAIT WINDOW command is issued, or a Visual FoxPro system message is displayed.

TIMEOUT nSeconds

Specifies the number of seconds that can elapse without input from the keyboard or the mouse before the WAIT is terminated. nSeconds specifies the number seconds (fractional seconds are permitted) that elapse. If TIMEOUT isn't the last clause in WAIT, Visual FoxPro generates a syntax error message.

Remarks

If a WAIT message is displayed in Visual FoxPro for Windows, pressing the Shift or CTRL keys hides all windows including the WAIT message.