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

Vicon Shogun banner


Dynamically positions and/or sizes the user controls managed by controlID. For a description of forms, see createForm.

The form dynamically lays out all user controls anchored to it, or managed by it, based on its current size and position.

For top-level forms, the form's size and position is the bounding rectangle of the user window. For forms created using createForm, the size and position is either set explicitly using setControlPos, or automatically, if the form is being managed and anchored to another form.

Top-level forms automatically lay themselves out when a user window is sized and/or docked/undocked, so using layoutForm is unnecessary. Top-level forms only need to have this command called on them once, at the end of the creation script, after all the layout logic has been specified using setControlAnchor. Non-top-level forms need to have layoutForm called for them if they are not being managed by another form.

Functional area

User Window

Command syntax


layoutForm userControlID


controlIDintyesID of form user control to lay out.



Return value



// Anchor two controls two each other, and to the form top-level
int $windowId;
int $staticId, $textId;
int $formId;

// First create a User Window to place the Controls on
$windowId = `createWindow "MyWindow"`;

// Get the top-level form ID
$formId = `getTopLevelForm $windowId`;

// Create a label User Control, and add it to the form
$staticId = `createStaticBox $windowId -text "Name" -form $formId`;

// Create a Text Box Control in the window. Also add it to the
// top-level form.
$textId = `createTextBox $windowId -form $formId`;

// Attach the Static User Control to the top and to the left
// of the top-level form
setControlAnchor $staticId "left" "left" 0;
setControlAnchor $staticId "top" "top" 0;

// Make the Text Box User Control stretch from the right side
// of the Static Box, to the right side of the User Window
setControlAnchor $textId "top" "top" 0 -target $staticId;
setControlAnchor $textId "left" "right" 5 -target $staticId;
setControlAnchor $textId "right" "right" 0;

// Issue the call to lay out the top level form. We only
// need to do this once
layoutForm $formId;

Additional information

Related commands