This information is for Vicon Shogun 1.7. For up-to-date help, see the latest Shogun documentation.

Vicon Shogun banner


Sets 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.

You can explicitly lay out all of your user controls using this method, or by using the setControlAnchor command to have the user controls be dynamically sized/positioned for you. Using setControlAnchor is the preferred method, since the layout logic only needs to be specified once and the user controls will be sized/placed automatically any time the user window gets resized.

All user controls have a default size, and are created in the top left corner of the user window, so they must be placed by using either the -pos option when being created, using setControlPos, or setControlAnchor. Otherwise, all of the user controls are piled on top of one another in the top left corner of the user window.

Functional area

User Window

Command syntax


setControlPos userControlID intArray[4]


intArrayint_arrayyesA four-element int array representing a rectangle, which specifies the initial size/position of the control relative to the top left corner of the user window. The order is Left, Top, Right, Bottom
userControlIdintyesID of the user control to set position for.



Return value



// Position the control in the middle of the User Window
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 "I am centered"`;

// Get the rect of the User Window, so we can center the
// Text Box in it$rect = `getWindowRect $windowId`;

// Now center it in the 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