/
getControlPos
getControlPos
Description
Gets the position of the user control that is specified by userControlID
.
intArray holds the x,y coordinates of the 4 points of a rectangle, whose coordinates are relative to the top/left corner of the user window that the control is on.
Functional area
User Window
Command syntax
Syntax
getControlPos userControlID |
Arguments
Name | Type | Required | Comments |
---|---|---|---|
userControlId | int | yes | ID of user control to get position for. |
Flags
None
Return value
integer array
Examples
// Get the position and size of the User Control int $windowId; int $controlId; int $rect[4]; string $height, $width; // First create a User Window to place the Control on $windowId = `createWindow "MyWindow"`; // Create a Text Box Control in the window. $controlId = `createTextBox $windowId`; // Get the rect of the User Control. Since we haven't // positioned it, it should be the default size, positioned // at the top corner of the User Window (0, 0) $rect = `getControlPos $controlId`; // Calculate its width and height $width = "width: " + string( $rect[2] - $rect[0] ); $height = "height: " + string( $rect[3] - $rect[1] ); print $width; print $height;
Additional information
Related commands
, multiple selections available,