---
name: "ctrlCreate"
type: command
status: ok
groups: ["GUI Control"]
arma3_since: "1.26"
locality: {"argument": null, "effect": null, "server_exec": false}
source: https://community.bistudio.com/wiki/ctrlCreate
revid: 378109
updated: 2026-02-15T22:08:16Z
---

# ctrlCreate

*Command · GUI Control · Arma 3 v1.26*

## Description

Creates a new control in the given display.

The control class could be an existing class from the [main config](../commands/configFile.md) or a custom class defined in the [mission config](../commands/missionConfigFile.md).
The main config is searched first, if the class does not exist there, the mission config is searched.
Some of the common controls defined in the main config that can be used with this command:

> [!NOTE]
> This list contains controls which are guaranteed to work with this command. However, controls not listed here should work as well - as long as they are properly defined.

| Class | Description | Available since |
|---|---|---|
| RscText | simple text box |  |
| RscStructuredText | text box which supports [structured text](../topics/Structured_Text.md) |  |
| RscTextMulti | simple multiline text box |  |
| RscPicture | simple picture box |  |
| RscPictureKeepAspect | picture box that doesn't stretch picture |  |
| RscEdit | input box |  |
| RscEditMulti | multiline input box |  |
| RscEditReadOnly | input box with | Arma 3 v1.98 |
| RscEditMultiReadOnly | multiline input box with | Arma 3 v1.98 |
| RscTree | tree view control |  |
| RscTreeMulti | multi-select tree view | Arma 3 v2.02 |
| RscTreeSearch | searchable tree view control (see Example 4) |  |
| RscVideo | picture control with autostart for video texture (see [BIS_fnc_playVideo](../functions/BIS_fnc_playVideo.md)) |  |
| RscVideoKeepAspect | picture control for video to keep original video aspect ratio |  |
| RscButtonMenuBIKI | shortcut button with url pointing to "https://community.bistudio.com/wiki/" | Arma 3 v1.98 |
| RscControlsGroup | default controls group |  |
| RscControlsGroupNoScrollbars | controls group without scrollbars |  |
| RscControlsGroupNoHScrollbars | controls group without horizontal scrollbar |  |
| RscControlsGroupNoVScrollbars | controls group without vertical scrollbar |  |

> [!IMPORTANT]
> If you are creating CT_MAP control dynamically, use [ctrlMapSetPosition](../commands/ctrlMapSetPosition.md) to update control position instead of [ctrlSetPosition](../commands/ctrlSetPosition.md).

## Syntax

```sqf
display ctrlCreate [class, idc, controlsGroup]
```

**Parameters:**

- `display`: [Display](../topics/Display.md) - display in which control will be created
- `class`: [String](../topics/String.md) or Arma 3 v2.14 [Config](../topics/Config.md) - existing classname (see ctrlCreate/classnames) of the new control;  Arma 3 v1.70 it is possible to use classes defined in mission config
- `idc`: [Number](../topics/Number.md) - IDC of the new control. Use -1 if not needed. Using 0 will use the IDC that is provided by the class.

  > [!WARNING]
  > Be careful when setting the IDC to `-1` if the GUI also contains a CT_LISTNBOX since `idcLeft` and `idcRight` by default have `idc = -1;`.
- `controlsGroup`: [Control](../topics/Control.md) - (Optional, default [controlNull](../commands/controlNull.md)) creates controls in existing controls group

**Returns:** [Control](../topics/Control.md)

## Examples

### Example 1

```sqf
_display ctrlCreate ["RscText", 1234];
```

### Example 2

```sqf
_map = findDisplay 46 ctrlCreate ["RscMapControl", -1];
_multiLineText = findDisplay 46 ctrlCreate ["RscTextMulti", -1];
_multiLineEdit = findDisplay 46 ctrlCreate ["RscEditMulti", -1];
```

### Example 3

```sqf
myControl = findDisplay 0 ctrlCreate ["RscText", 1234, findDisplay 0 displayCtrl 2300];
```

### Example 4

Create Tree View control with search. Available `RscTreeSearch` class is hardcoded to be used with `RscEdit` with idc `645`.
Example below demonstrates how to. After tree is generated, try typing something in the top box.

```sqf
0 spawn 
{
    disableSerialization;

    _display = (if (is3DEN) then {findDisplay 313} else {[] call BIS_fnc_displayMission}) createDisplay "RscDisplayEmpty";

    _edit = _display ctrlCreate ["RscEdit", 645];
    _edit ctrlSetPosition [0,0,1,0.04];
    _edit ctrlSetBackgroundColor [0,0,0,1];
    _edit ctrlCommit 0;

    _tv = _display ctrlCreate ["RscTreeSearch", -1];
    _tv ctrlSetFont "EtelkaMonospacePro";
    _tv ctrlSetFontHeight 0.03;
    _tv ctrlSetPosition [0,0.06,1,0.94];
    _tv ctrlSetBackgroundColor [0,0,0,1];
    _tv ctrlCommit 0;

    _classes = "true" configClasses (configFile >> "CfgVehicles");

    for "_i" from 0 to 5 do
    {
        _tv tvAdd [[], configName selectRandom _classes];
        for "_j" from 0 to 5 do
        {
            _tv tvAdd [[_i], configName selectRandom _classes];
            for "_k" from 0 to 5 do
            {
                _tv tvAdd [[_i, _j], configName selectRandom _classes];
                for "_n" from 0 to 5 do
                {
                    _tv tvAdd [[_i, _j, _k], configName selectRandom _classes];
                };
            };
        };
    };
};
```

### Example 5

Create a simple submit edit box and show content in hint:

```sqf
disableSerialization;
private _display = findDisplay 46 createDisplay "RscDisplayEmpty";
private _ctrlGroup = _display ctrlCreate ["RscControlsGroupNoScrollbars", -1];
private _ctrlBackground = _display ctrlCreate ["RscTextMulti", -1, _ctrlGroup];
IDD_EDIT_BOX = 123;
private _ctrlEdit = _display ctrlCreate ["RscEditMulti", IDD_EDIT_BOX, _ctrlGroup];
private _ctrlButton = _display ctrlCreate ["RscShortcutButton", -1, _ctrlGroup];
_ctrlGroup ctrlSetPosition [0.5, 0.5, 0, 0];
_ctrlGroup ctrlCommit 0;
_ctrlBackground ctrlSetPosition [0, 0, 0.5, 0.5];
_ctrlBackground ctrlSetBackgroundColor [0.5, 0.5, 0.5, 0.9];
_ctrlBackground ctrlSetText "ENTER TEXT:";
_ctrlBackground ctrlEnable false;
_ctrlBackground ctrlCommit 0;
_ctrlEdit ctrlSetPosition [0.01, 0.05, 0.48, 0.34];
_ctrlEdit ctrlSetBackgroundColor [0, 0, 0, 0.5];
_ctrlEdit ctrlCommit 0;
_ctrlButton ctrlSetPosition [0.185, 0.42, 0.13, 0.05];
_ctrlButton ctrlCommit 0;
_ctrlButton ctrlSetText "SUBMIT";
_ctrlButton ctrlAddEventHandler ["ButtonClick", 
{
    params ["_ctrl"];
    _display = ctrlParent _ctrl;
    _text = ctrlText (_display displayCtrl IDD_EDIT_BOX);
    if (_text == "") then { _text = "EMPTY" };
    hint _text;
    _display closeDisplay 1;
}];
ctrlSetFocus _ctrlEdit;
_ctrlGroup ctrlSetPosition [0.25, 0.25, 0.5, 0.5];
_ctrlGroup ctrlCommit 0.1;
playSound "Hint3";
```

### Example 6

```sqf
// since Arma 3 v2.14
findDisplay 46 createDisplay "RscDisplayEmpty" ctrlCreate [configFile >> "RscDisplayBootcampMsgBox" >> "controls" >> "BootcampMessageBox", -1];
```

### Example 7

```sqf
// Creates a vertical slider. Execute in [[Eden Editor]]
private _display = findDisplay 313 createDisplay "RscDisplayEmpty";
private _ctrlSlider = _display ctrlCreate ["ctrlSliderV", -1];

_ctrlSlider ctrlSetPosition 
[
  0.5 - 0.5 * pixelGrid * pixelW * 10, 
  0.5 - 0.5 * pixelGrid * pixelH * 40, 
  0.5 * pixelGrid * pixelW * 20, 
  0.5 * pixelGrid * pixelH * 80
];

_ctrlSlider ctrlCommit 0;
```

### Example 8

```sqf
// The following script creates a button that follows the position of the player unit in [[Eden Editor]]

if (isNull player) exitWith {["Place a player entity first", 1] call BIS_fnc_3DENNotification};

private _display = findDisplay 313;

private _ctrlButton = _display ctrlCreate ["ctrlButton", 1234];
_ctrlButton ctrlSetText "Delete Me";

_ctrlButton ctrlAddEventHandler ["ButtonClick",
{
    params ["_ctrlButton"];

    onEachFrame {};
    _ctrlButton spawn {sleep 0.05; ctrlDelete _this};
}];

onEachFrame
{
    private _ctrlButton = findDisplay 313 displayCtrl 1234;

    if (isNull player) exitWith {};

    (worldToScreen getPosWorld player) params ["_xPos", "_yPos"];

    _ctrlButton ctrlSetPosition [_xPos, _yPos, 0.1 * safeZoneW, 0.05 * safeZoneH];
    _ctrlButton ctrlCommit 0;
};
```

## See also

[ctrlMapSetPosition](../commands/ctrlMapSetPosition.md) · [allControls](../commands/allControls.md) · [allDisplays](../commands/allDisplays.md) · [controlsGroupCtrl](../commands/controlsGroupCtrl.md) · [ctrlDelete](../commands/ctrlDelete.md) · [ctrlModel](../commands/ctrlModel.md) · [ctrlSetModel](../commands/ctrlSetModel.md) · [ctrlPosition](../commands/ctrlPosition.md) · [ctrlSetPosition](../commands/ctrlSetPosition.md) · [ctrlClassName](../commands/ctrlClassName.md) · [ctrlModelScale](../commands/ctrlModelScale.md) · [ctrlSetModelScale](../commands/ctrlSetModelScale.md) · [ctrlModelDirAndUp](../commands/ctrlModelDirAndUp.md) · [ctrlSetModelDirAndUp](../commands/ctrlSetModelDirAndUp.md) · [displayParent](../commands/displayParent.md)

<sub>Source: [BI Community Wiki — ctrlCreate](https://community.bistudio.com/wiki/ctrlCreate) (revision 378109).</sub>
