---
title: "createGroupBox"
canonical: "https://help.vicon.com/space/Shogun111/13207722/createGroupBox"
format: markdown
---
# Description

Creates a group box user control on the user window that is specified by `windowID`.

A group box is a form user control with a visual component. A group box is usually used to demarcate groups of controls. As it is a form, it can also manage the layout of those controls. For information on how to use the layout features of a form, see [createForm](https://vicon-help.atlassian.net/wiki/spaces/Shogun111/pages/13207720).

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](https://vicon-help.atlassian.net/wiki/spaces/Shogun111/pages/13208422) 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

## Syntax

|  |
| --- |
| `createGroupBox parentWindowID [-hidden] [-text string] [-pos integer array] [-form integer]` |

### Arguments

| **Name** | **Type** | **Required** | **Comments** |
| --- | --- | --- | --- |
| `windowId` | int | yes | ID of user window to place the control on. |

> Macro (scroll-pagebreak)

### Flags

> Macro (scroll-tablelayout)

| **Name** | **Flag arguments** | **Argument type** | **Exclusive to** | **Comments** |
| --- | --- | --- | --- | --- |
| `hidden` | 0 | — | — | Specifies that the control should be hidden initially. Call [showControl](https://vicon-help.atlassian.net/wiki/spaces/Shogun111/pages/13208540) to subsequently make it visible. The default is for it to be visible. |
| `text` | 1 | string | — | The text that gets displayed with the control. The default is no text. |
| `pos` | 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, and Bottom. The default is a group box 200 units high by 200 units wide. |
| `form` | 1 | integer | — | Control ID of the form user control which will dynamically position this control. |

## Return value

integer

## Examples

```plaintext
// Create a group box user control.
int $windowId;
int $groupId; 
int $topForm;
int $controlId;
 
// First create a user window to place the Control on
$windowId = `createWindow "MyWindow"`;
 
// Get the top level form
$topForm = `getTopLevelForm $windowId`;
 
// Create the group box, adding it as a child of the
// top level form.
$groupId = `createGroupBox $windowId -form $topForm-text "Group Box"`;
setControlAnchor $groupId "top" "top" 0;
setControlAnchor $groupId "left" "left" 0;
setControlAnchor $groupId "right" "right" 0;  
```

> Macro (scroll-pagebreak)

```plaintext
// Now create a Text Box, and anchor it so that the text box spans
// the length of the group box
$controlId = `createTextBox $windowId -text "Text Box" -form $groupId`; 
// Anchor it
setControlAnchor $controlId "top" "top" 20;
setControlAnchor $controlId "left" "left" 20; 
setControlAnchor $controlId "right" "right" 20; 
// Now, call layoutForm, which will do the managing of the controls
// under the form
layoutForm $topForm;
```

# Additional information

## Related commands

- [layoutForm](https://vicon-help.atlassian.net/wiki/spaces/Shogun111/pages/13208180)
- [setControlAnchor](https://vicon-help.atlassian.net/wiki/spaces/Shogun111/pages/13208420)