WAIT Command

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

WAIT [cMessageText] [TO VarName] [WINDOW [AT nRow, nColumn]] [NOWAIT]



Specifies a custom message to display. You can specify any valid Visual FoxPro function, object, or data type instead of cMessageText. If you omit cMessageText, Visual FoxPro displays the default message. If cMessageText is an empty string (""), Visual FoxPro does not display a message and waits until a key is pressed before continuing program execution.

The length of cMessageText can be up to 255 characters.


Visual FoxPro converts object references to the string, "(Object)". If the function you specify evaluates to a noncharacter value, Visual FoxPro automatically uses the TRANSFORM( ) function to provide the character equivalent. In the following example, a character type date is returned and passed to WAIT WINDOW:

 CopyCode imageCopy Code
TO VarName

Saves the key pressed to a variable or an array element.

If the variable or an array element you specify with VarName does not 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.


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.

Beginning with Visual FoxPro 7, core font attributes including font name, font size and font style are derived from the font characteristics specified in the Appearance tab of the Windows Display Control Panel.

AT nRow, nColumn

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


Continues program execution immediately after the message is displayed.

The program does not 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.


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.


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, the fractional seconds that are permitted, that elapse. If TIMEOUT is not the last clause in WAIT, Visual FoxPro generates a syntax error message.

Expand imageRemarks

Expand imageSee Also

© , 1996-2020 • Updated: 11/10/20
Comment or report problem with topic