Skip to main content
Version: Next

SET WINDOW RECT

SET WINDOW RECT ( left ; top ; right ; bottom {; window}{; *} )

ParameterTypeDescription
leftIntegerGlobal left coordinate of window's contents area
topIntegerGlobal top coordinate of window's contents area
rightIntegerGlobal right coordinate of window's contents area
bottomIntegerGlobal bottom coordinate of window's contents area
windowIntegerWindow reference number, or Frontmost window of current process, if omitted
*OperatorIf omitted (default) = change window to foreground
If passed = do not change the level of the window

This command is not thread-safe, it cannot be used in preemptive code.

Description

The SET WINDOW RECT command changes the global coordinates of the window whose reference number is passed in window. If the window does not exist, the command does nothing.

If you omit the window parameter, SET WINDOW RECT applies to the frontmost window for the current process.

This command can resize and move the window, depending on the new coordinates passed.

The coordinates must be expressed relative to the top left corner of the contents area of the application window (Windows MDI mode) or to the main screen (macOS and Windows SDI mode). The coordinates indicate the rectangle corresponding to the contents area of the window (excluding title bars and borders).

Warning: Be aware that by using this command, you may move a window beyond the limits of the main window (on Windows) or of the screens (on Macintosh). To prevent this, use commands such as Screen width and Screen height to double-check the new coordinates of the window.

By default, executing this command automatically moves the window designated by the window parameter to the foreground (if this parameter is used). You can disable this by passing the * as the last parameter. In this case, the command no longer changes the original level ("z" coordinate) of the window.

This command does not affect form objects. If the window contains a form, the form objects are not moved or resized by the command (regardless of their properties). Only the window is modified. In order to modify a form window while taking the resizing properties and the objects it contains into account, you must use the RESIZE FORM WINDOW command.

Example 1

See example for the WINDOW LIST command.

Example 2

Given the following window:

After execution of the following line:

 SET WINDOW RECT(100;100;300;300)

The window appears as follows:

See also

CONVERT COORDINATES
DRAG WINDOW
GET WINDOW RECT
RESIZE FORM WINDOW