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

Vicon Shogun banner


Creates a form user control on the given user window specified by windowID.

A form is an invisible rectangle that manages the size and position of other user controls. To have controls be managed by a form, use the -form option on the control creation command (e.g. createTextBox). Then use setControlAnchor to "anchor" the controls to the sides of the form (or to other controls). When the form gets moved or resized, the controls will automatically be re-organized according to the anchor logic specified.

Each user window has a form which can be obtained using getTopLevelForm. Upon creation of the user window, obtain the top level form, and use it as the argument to the -form flag in the control creation commands.

Forms can be nested, forming hierarchies of forms to facilitate complex control layouts. The control is initially placed in the top-left corner of the user window, and must be placed by using the -pos option, or by using the setControlPos command.

The command returns the Control ID of the user control, which should be saved for later operations on the control.

Functional area

User Window

Command syntax


createForm parentWindowID [-hidden] [-pos integer array] [-form integer]


windowIdintyesID of user window to place the form on.


NameFlag argumentsArgument typeExclusive toComments
pos1integer arrayA four element int array representing a rectangle, which specifies the initial size/position of the form relative to the top left corner of the user window. The element order is Left, Top, Right, Bottom. The default form is 200 units high x 200 units wide.
form1integerControl ID of the form user control which dynamically positions this form.

Return value



// Create a Form User Control.
int $windowId;
int $ formId;

// First create a User Window to place the Control on
$windowId = `createWindow "MyWindow"`;
// Get the top level form
$topForm = `getTopLevelForm $windowId`;
// Specify the size of the Form - 300x300
$rect[0] = 20; // Left
$rect[1] = 20; // Top
$rect[2] = 320; // Right
$rect[3] = 320; // Bottom
// Create the Form, adding it as a child of the
// top level form.
$formId = `createForm $windowId -form $topForm -pos $rect`;
// Now create a Text Box, and anchor it so that the text box spans
// the length of the Form
$controlId = `createTextBox $windowId -text "Text Box" -form $formId`;
// Anchor it
$controlId "top" "top" 20;
$controlId "left" "left" 20;
$controlId "right" "right" 20;
// Now, call layoutForm, which will do the managing of the controls
// under the form
layoutForm $topForm;

Additional information

Related commands