{"name":"ctrlCreate","operator":null,"title":"ctrlCreate","type":"command","url":"https://community.bistudio.com/wiki/ctrlCreate","revid":378109,"updated":"2026-02-15T22:08:16Z","groups":["GUI Control"],"status":"ok","replaced_by":[],"games":[{"game":"arma3","name":"Arma 3","version":"1.26"}],"since":{"game":"arma3","name":"Arma 3","version":"1.26"},"arma3_since":"1.26","branch":null,"locality":{"argument":null,"effect":null,"server_exec":false},"exec":null,"description":"Creates a new control in the given display.\n\nThe control class could be an existing class from the main config or a custom class defined in the mission config.\nThe main config is searched first, if the class does not exist there, the mission config is searched.\nSome of the common controls defined in the main config that can be used with this command:\n\n> [!NOTE]\n> 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.\n\n| Class | Description | Available since |\n|---|---|---|\n| RscText | simple text box |  |\n| RscStructuredText | text box which supports structured text |  |\n| RscTextMulti | simple multiline text box |  |\n| RscPicture | simple picture box |  |\n| RscPictureKeepAspect | picture box that doesn't stretch picture |  |\n| RscEdit | input box |  |\n| RscEditMulti | multiline input box |  |\n| RscEditReadOnly | input box with DialogControls-EditBox | Arma 3 v1.98 |\n| RscEditMultiReadOnly | multiline input box with DialogControls-EditBox | Arma 3 v1.98 |\n| RscTree | tree view control |  |\n| RscTreeMulti | multi-select tree view | Arma 3 v2.02 |\n| RscTreeSearch | searchable tree view control (see Example 4) |  |\n| RscVideo | picture control with autostart for video texture (see BIS_fnc_playVideo) |  |\n| RscVideoKeepAspect | picture control for video to keep original video aspect ratio |  |\n| RscButtonMenuBIKI | shortcut button with url pointing to \"https://community.bistudio.com/wiki/\" | Arma 3 v1.98 |\n| RscControlsGroup | default controls group |  |\n| RscControlsGroupNoScrollbars | controls group without scrollbars |  |\n| RscControlsGroupNoHScrollbars | controls group without horizontal scrollbar |  |\n| RscControlsGroupNoVScrollbars | controls group without vertical scrollbar |  |\n\n> [!IMPORTANT]\n> If you are creating CT_MAP control dynamically, use ctrlMapSetPosition to update control position instead of ctrlSetPosition.","syntaxes":[{"syntax":"display ctrlCreate [class, idc, controlsGroup]","since":null,"effect":null,"exec":null,"params":[{"name":"display","type":"Display","optional":false,"default":null,"description":"display in which control will be created","types":["Display"],"since":null,"text":"display: Display - display in which control will be created"},{"name":"class","type":"String or Arma 3 v2.14 Config","optional":false,"default":null,"description":"existing classname (see ctrlCreate/classnames) of the new control;  Arma 3 v1.70 it is possible to use classes defined in mission config","types":["String","Config"],"since":null,"text":"class: String or Arma 3 v2.14 Config - existing classname (see ctrlCreate/classnames) of the new control;  Arma 3 v1.70 it is possible to use classes defined in mission config"},{"name":"idc","type":"Number","optional":false,"default":null,"description":"IDC of the new control. Use -1 if not needed. Using 0 will use the IDC that is provided by the class.\n\n> [!WARNING]\n> 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;`.","types":["Number"],"since":null,"text":"idc: Number - IDC of the new control. Use -1 if not needed. Using 0 will use the IDC that is provided by the class.\n\n> [!WARNING]\n> 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;`."},{"name":"controlsGroup","type":"Control","optional":true,"default":"controlNull","description":"creates controls in existing controls group","types":["Control"],"since":null,"text":"controlsGroup: Control - (Optional, default controlNull) creates controls in existing controls group"}],"returns":{"type":"Control","types":["Control"],"description":null,"text":"Control"},"form":"binary","operator":null,"left":{"text":"display","types":["Display"]},"right":{"text":"[class, idc, controlsGroup]","types":["Array"]}}],"examples":[{"text":"```sqf\n_display ctrlCreate [\"RscText\", 1234];\n```","code":["_display ctrlCreate [\"RscText\", 1234];"]},{"text":"```sqf\n_map = findDisplay 46 ctrlCreate [\"RscMapControl\", -1];\n_multiLineText = findDisplay 46 ctrlCreate [\"RscTextMulti\", -1];\n_multiLineEdit = findDisplay 46 ctrlCreate [\"RscEditMulti\", -1];\n```","code":["_map = findDisplay 46 ctrlCreate [\"RscMapControl\", -1];\n_multiLineText = findDisplay 46 ctrlCreate [\"RscTextMulti\", -1];\n_multiLineEdit = findDisplay 46 ctrlCreate [\"RscEditMulti\", -1];"]},{"text":"```sqf\nmyControl = findDisplay 0 ctrlCreate [\"RscText\", 1234, findDisplay 0 displayCtrl 2300];\n```","code":["myControl = findDisplay 0 ctrlCreate [\"RscText\", 1234, findDisplay 0 displayCtrl 2300];"]},{"text":"Create Tree View control with search. Available `RscTreeSearch` class is hardcoded to be used with `RscEdit` with idc `645`.\nExample below demonstrates how to. After tree is generated, try typing something in the top box.\n\n```sqf\n0 spawn \n{\n    disableSerialization;\n\n    _display = (if (is3DEN) then {findDisplay 313} else {[] call BIS_fnc_displayMission}) createDisplay \"RscDisplayEmpty\";\n\n    _edit = _display ctrlCreate [\"RscEdit\", 645];\n    _edit ctrlSetPosition [0,0,1,0.04];\n    _edit ctrlSetBackgroundColor [0,0,0,1];\n    _edit ctrlCommit 0;\n\n    _tv = _display ctrlCreate [\"RscTreeSearch\", -1];\n    _tv ctrlSetFont \"EtelkaMonospacePro\";\n    _tv ctrlSetFontHeight 0.03;\n    _tv ctrlSetPosition [0,0.06,1,0.94];\n    _tv ctrlSetBackgroundColor [0,0,0,1];\n    _tv ctrlCommit 0;\n\n    _classes = \"true\" configClasses (configFile >> \"CfgVehicles\");\n\n    for \"_i\" from 0 to 5 do\n    {\n        _tv tvAdd [[], configName selectRandom _classes];\n        for \"_j\" from 0 to 5 do\n        {\n            _tv tvAdd [[_i], configName selectRandom _classes];\n            for \"_k\" from 0 to 5 do\n            {\n                _tv tvAdd [[_i, _j], configName selectRandom _classes];\n                for \"_n\" from 0 to 5 do\n                {\n                    _tv tvAdd [[_i, _j, _k], configName selectRandom _classes];\n                };\n            };\n        };\n    };\n};\n```","code":["0 spawn \n{\n\tdisableSerialization;\n\n\t_display = (if (is3DEN) then {findDisplay 313} else {[] call BIS_fnc_displayMission}) createDisplay \"RscDisplayEmpty\";\n\n\t_edit = _display ctrlCreate [\"RscEdit\", 645];\n\t_edit ctrlSetPosition [0,0,1,0.04];\n\t_edit ctrlSetBackgroundColor [0,0,0,1];\n\t_edit ctrlCommit 0;\n\n\t_tv = _display ctrlCreate [\"RscTreeSearch\", -1];\n\t_tv ctrlSetFont \"EtelkaMonospacePro\";\n\t_tv ctrlSetFontHeight 0.03;\n\t_tv ctrlSetPosition [0,0.06,1,0.94];\n\t_tv ctrlSetBackgroundColor [0,0,0,1];\n\t_tv ctrlCommit 0;\n\n\t_classes = \"true\" configClasses (configFile >> \"CfgVehicles\");\n\n\tfor \"_i\" from 0 to 5 do\n\t{\n\t\t_tv tvAdd [[], configName selectRandom _classes];\n\t\tfor \"_j\" from 0 to 5 do\n\t\t{\n\t\t\t_tv tvAdd [[_i], configName selectRandom _classes];\n\t\t\tfor \"_k\" from 0 to 5 do\n\t\t\t{\n\t\t\t\t_tv tvAdd [[_i, _j], configName selectRandom _classes];\n\t\t\t\tfor \"_n\" from 0 to 5 do\n\t\t\t\t{\n\t\t\t\t\t_tv tvAdd [[_i, _j, _k], configName selectRandom _classes];\n\t\t\t\t};\n\t\t\t};\n\t\t};\n\t};\n};"]},{"text":"Create a simple submit edit box and show content in hint:\n\n```sqf\ndisableSerialization;\nprivate _display = findDisplay 46 createDisplay \"RscDisplayEmpty\";\nprivate _ctrlGroup = _display ctrlCreate [\"RscControlsGroupNoScrollbars\", -1];\nprivate _ctrlBackground = _display ctrlCreate [\"RscTextMulti\", -1, _ctrlGroup];\nIDD_EDIT_BOX = 123;\nprivate _ctrlEdit = _display ctrlCreate [\"RscEditMulti\", IDD_EDIT_BOX, _ctrlGroup];\nprivate _ctrlButton = _display ctrlCreate [\"RscShortcutButton\", -1, _ctrlGroup];\n_ctrlGroup ctrlSetPosition [0.5, 0.5, 0, 0];\n_ctrlGroup ctrlCommit 0;\n_ctrlBackground ctrlSetPosition [0, 0, 0.5, 0.5];\n_ctrlBackground ctrlSetBackgroundColor [0.5, 0.5, 0.5, 0.9];\n_ctrlBackground ctrlSetText \"ENTER TEXT:\";\n_ctrlBackground ctrlEnable false;\n_ctrlBackground ctrlCommit 0;\n_ctrlEdit ctrlSetPosition [0.01, 0.05, 0.48, 0.34];\n_ctrlEdit ctrlSetBackgroundColor [0, 0, 0, 0.5];\n_ctrlEdit ctrlCommit 0;\n_ctrlButton ctrlSetPosition [0.185, 0.42, 0.13, 0.05];\n_ctrlButton ctrlCommit 0;\n_ctrlButton ctrlSetText \"SUBMIT\";\n_ctrlButton ctrlAddEventHandler [\"ButtonClick\", \n{\n    params [\"_ctrl\"];\n    _display = ctrlParent _ctrl;\n    _text = ctrlText (_display displayCtrl IDD_EDIT_BOX);\n    if (_text == \"\") then { _text = \"EMPTY\" };\n    hint _text;\n    _display closeDisplay 1;\n}];\nctrlSetFocus _ctrlEdit;\n_ctrlGroup ctrlSetPosition [0.25, 0.25, 0.5, 0.5];\n_ctrlGroup ctrlCommit 0.1;\nplaySound \"Hint3\";\n```","code":["disableSerialization;\nprivate _display = findDisplay 46 createDisplay \"RscDisplayEmpty\";\nprivate _ctrlGroup = _display ctrlCreate [\"RscControlsGroupNoScrollbars\", -1];\nprivate _ctrlBackground = _display ctrlCreate [\"RscTextMulti\", -1, _ctrlGroup];\nIDD_EDIT_BOX = 123;\nprivate _ctrlEdit = _display ctrlCreate [\"RscEditMulti\", IDD_EDIT_BOX, _ctrlGroup];\nprivate _ctrlButton = _display ctrlCreate [\"RscShortcutButton\", -1, _ctrlGroup];\n_ctrlGroup ctrlSetPosition [0.5, 0.5, 0, 0];\n_ctrlGroup ctrlCommit 0;\n_ctrlBackground ctrlSetPosition [0, 0, 0.5, 0.5];\n_ctrlBackground ctrlSetBackgroundColor [0.5, 0.5, 0.5, 0.9];\n_ctrlBackground ctrlSetText \"ENTER TEXT:\";\n_ctrlBackground ctrlEnable false;\n_ctrlBackground ctrlCommit 0;\n_ctrlEdit ctrlSetPosition [0.01, 0.05, 0.48, 0.34];\n_ctrlEdit ctrlSetBackgroundColor [0, 0, 0, 0.5];\n_ctrlEdit ctrlCommit 0;\n_ctrlButton ctrlSetPosition [0.185, 0.42, 0.13, 0.05];\n_ctrlButton ctrlCommit 0;\n_ctrlButton ctrlSetText \"SUBMIT\";\n_ctrlButton ctrlAddEventHandler [\"ButtonClick\", \n{\n\tparams [\"_ctrl\"];\n\t_display = ctrlParent _ctrl;\n\t_text = ctrlText (_display displayCtrl IDD_EDIT_BOX);\n\tif (_text == \"\") then { _text = \"EMPTY\" };\n\thint _text;\n\t_display closeDisplay 1;\n}];\nctrlSetFocus _ctrlEdit;\n_ctrlGroup ctrlSetPosition [0.25, 0.25, 0.5, 0.5];\n_ctrlGroup ctrlCommit 0.1;\nplaySound \"Hint3\";"]},{"text":"```sqf\n// since Arma 3 v2.14\nfindDisplay 46 createDisplay \"RscDisplayEmpty\" ctrlCreate [configFile >> \"RscDisplayBootcampMsgBox\" >> \"controls\" >> \"BootcampMessageBox\", -1];\n```","code":["// since Arma 3 v2.14\nfindDisplay 46 createDisplay \"RscDisplayEmpty\" ctrlCreate [configFile >> \"RscDisplayBootcampMsgBox\" >> \"controls\" >> \"BootcampMessageBox\", -1];"]},{"text":"```sqf\n// Creates a vertical slider. Execute in [[Eden Editor]]\nprivate _display = findDisplay 313 createDisplay \"RscDisplayEmpty\";\nprivate _ctrlSlider = _display ctrlCreate [\"ctrlSliderV\", -1];\n\n_ctrlSlider ctrlSetPosition \n[\n  0.5 - 0.5 * pixelGrid * pixelW * 10, \n  0.5 - 0.5 * pixelGrid * pixelH * 40, \n  0.5 * pixelGrid * pixelW * 20, \n  0.5 * pixelGrid * pixelH * 80\n];\n\n_ctrlSlider ctrlCommit 0;\n```","code":["// Creates a vertical slider. Execute in [[Eden Editor]]\nprivate _display = findDisplay 313 createDisplay \"RscDisplayEmpty\";\nprivate _ctrlSlider = _display ctrlCreate [\"ctrlSliderV\", -1];\n\n_ctrlSlider ctrlSetPosition \n[\n  0.5 - 0.5 * pixelGrid * pixelW * 10, \n  0.5 - 0.5 * pixelGrid * pixelH * 40, \n  0.5 * pixelGrid * pixelW * 20, \n  0.5 * pixelGrid * pixelH * 80\n];\n\n_ctrlSlider ctrlCommit 0;"]},{"text":"```sqf\n// The following script creates a button that follows the position of the player unit in [[Eden Editor]]\n\nif (isNull player) exitWith {[\"Place a player entity first\", 1] call BIS_fnc_3DENNotification};\n\nprivate _display = findDisplay 313;\n\nprivate _ctrlButton = _display ctrlCreate [\"ctrlButton\", 1234];\n_ctrlButton ctrlSetText \"Delete Me\";\n\n_ctrlButton ctrlAddEventHandler [\"ButtonClick\",\n{\n    params [\"_ctrlButton\"];\n\n    onEachFrame {};\n    _ctrlButton spawn {sleep 0.05; ctrlDelete _this};\n}];\n\nonEachFrame\n{\n    private _ctrlButton = findDisplay 313 displayCtrl 1234;\n\n    if (isNull player) exitWith {};\n\n    (worldToScreen getPosWorld player) params [\"_xPos\", \"_yPos\"];\n\n    _ctrlButton ctrlSetPosition [_xPos, _yPos, 0.1 * safeZoneW, 0.05 * safeZoneH];\n    _ctrlButton ctrlCommit 0;\n};\n```","code":["// The following script creates a button that follows the position of the player unit in [[Eden Editor]]\n\nif (isNull player) exitWith {[\"Place a player entity first\", 1] call BIS_fnc_3DENNotification};\n\nprivate _display = findDisplay 313;\n\nprivate _ctrlButton = _display ctrlCreate [\"ctrlButton\", 1234];\n_ctrlButton ctrlSetText \"Delete Me\";\n\n_ctrlButton ctrlAddEventHandler [\"ButtonClick\",\n{\n    params [\"_ctrlButton\"];\n\n    onEachFrame {};\n    _ctrlButton spawn {sleep 0.05; ctrlDelete _this};\n}];\n\nonEachFrame\n{\n    private _ctrlButton = findDisplay 313 displayCtrl 1234;\n\n    if (isNull player) exitWith {};\n\n    (worldToScreen getPosWorld player) params [\"_xPos\", \"_yPos\"];\n\n    _ctrlButton ctrlSetPosition [_xPos, _yPos, 0.1 * safeZoneW, 0.05 * safeZoneH];\n    _ctrlButton ctrlCommit 0;\n};"]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["ctrlMapSetPosition","allControls","allDisplays","controlsGroupCtrl","ctrlDelete","ctrlModel","ctrlSetModel","ctrlPosition","ctrlSetPosition","ctrlClassName","ctrlModelScale","ctrlSetModelScale","ctrlModelDirAndUp","ctrlSetModelDirAndUp","displayParent"],"notes":[],"categories":["Arma 3: New Scripting Commands","Arma 3: Scripting Commands","Command Group: GUI Control","Introduced with Arma 3 version 1.26","Scripting Commands"]}