Vicon Shogun banner

Description

Gets the top-level form of the user window that is specified by windowID. For a description of a form, see createForm.

Each user window has a form that can be used as the starting point for dynamically placing and sizing user controls. When the form ID is obtained, use setControlAnchor to attach the controls to the sides of the form rectangle. As the user window's size changes, the form changes size as well, positioning the user controls bound to it.

Forms can be nested, so forms created using createForm can be anchored to the top-level form of a user window, to create a hierarchy of forms that dynamically manage user control layout.

Using forms to lay out user controls is easier and preferable to using setControlPos, as the layout logic only needs to be applied at creation time, not each time the user window changes size.

Functional area

User Window

Command syntax

Syntax

getTopLevelForm windowID

Arguments

NameTypeRequiredComments
windowIDintyesID of user window to get the top-level form for.

Flags

None

Return value

integer

Examples

// Use the top-level Form to lay out User Controls.
int $windowId;
int $controlId;
int $formId;

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

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

// Create a Text Box Control in the window. Add it to the
// top-level form we just got
$controlId = `createTextBox $windowId -form $formId`;

// Attach the text controls sides to the top level form,
// so that it stretches across the top of the Window
setControlAnchor $controlId "left" "left" 5;
setControlAnchor $controlId "right" "right" 5;
setControlAnchor $controlId "top" "top" 5;

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

Additional information

Related commands