/
getWindowRect

getWindowRect

Description

Gets the bounding rectangle of the User Window specified by windowId.

The return value represents a rectangle holding the Left, Top, Right, and Bottom values of the user window. User controls placed with setControlPos or the -pos option on creation should be placed relative to the top left corner of the user window.

Functional area

User Window

Command syntax

Syntax

getWindowRect userWindowID

Arguments

NameTypeRequiredComments
userWindowIDintyesID of user window to get the bounding rectangle for.

Flags

None

Return value

integer array

Examples

// Get the bounding rect of a User Window, and place
// a control within it.
int $windowId;
int $controlId;
int $rect[4], $controlRect[4];
 
// First create a User Window to place the Control on
$windowId = `createWindow "MyWindow"`;
 
// Create a Text Box Control in the window.
$controlId = `createTextBox $windowId -text "Get Window Rect Sample"`;
 
// Get the rect of the User Window.
$rect = `getWindowRect $windowId`;
 
// Position the control in the middle of the User Window
$controlRect[0] = $rect[0];
$controlRect[1] = ($rect[1] + $rect[3]) / 2;
$controlRect[2] = $rect[2];
$controlRect[3] = $controlRect[1] + 24;
setControlPos $controlId $controlRect;

Additional information

Related commands