Creates a form user control on the given user window specified by
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.
|int||yes||ID of user window to place the form on.|
|Name||Flag arguments||Argument type||Exclusive to||Comments|
|1||integer array||—||A 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.|
|1||integer||—||Control ID of the form user control which dynamically positions this form.|
// Create a Form User Control.
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 = 20; // Left
$rect = 20; // Top
$rect = 320; // Right
$rect = 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