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.
User Window
getControlPos userControlID |
Name | Type | Required | Comments |
---|---|---|---|
userControlId | int | yes | ID of user control to get position for. |
None
integer array
// 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;