{"name":"CT CHECKBOXES","title":"CT CHECKBOXES","type":"topic","url":"https://community.bistudio.com/wiki/CT_CHECKBOXES","revid":295501,"updated":"2021-11-15T22:55:38Z","aliases":["DialogControls-CheckBoxes"],"markdown":"### Introduction\n\nThe Checkboxes (also known as textual checkboxes) are a set of state change buttons, ordered by columns and rows. Unlike the Toolbox Control more than one button can become active. Maximum number of checkboxes available for a single control is 32. It is possible to create more than 32 checkboxes, however over-the-limit checkboxes will just become duplicates. `CT_CHECKBOXES` fully inherits from CT_TOOLBOX, the difference is that with CheckBoxes one can make multiple selections or have no item selected. When CheckBoxes style is `ST_PICTURE`, the `strings` property is treated as array of textures, and `checked_strings` property is ignored.\n\n#### Related commands & functions\n\n- Commands: General\n- Commands: UI Eventhandlers\n- Commands: Listbox\n- ctrlSetChecked\n- ctrlChecked\n\n#### Related User Interface Eventhandlers\n\n- Events: General\n- Events: Listbox\n- Events: Checkbox\n\n### Alphabetical Order\n\n> [!NOTE]\n> TokenNames common to most controls, such as x, y, w, h, text, idc... can be found **here**.\n\n> [!WARNING]\n> Not all of the listed attributes might have an effect nor might the list be complete. All attributes were gathered with [this](https://github.com/7erra/BIKI.VR/blob/master/fnc/generateCTPage.sqf) config crawler.\n\n```cpp\n#define CT_CHECKBOXES 7\n```\n\n#### C\n\n##### checked_strings\n\n**Type:** Array\n\n**Description:** Checkboxes texts to display when checkboxes are checked\n\n```cpp\nchecked_strings[] = {\"CHECKED\"};\n```\n\n##### color\n\n**Type:** Array\n\n**Description:** n/a\n\n```cpp\ncolor[] = {0,0,0,0};\n```\n\n##### colorBackground\n\n**Type:** Array\n\n**Description:** Color of the background when checkbox is not in focus (doesn't matter if checked or not).\n\n```cpp\ncolorBackground[] = {0,0,0,0};\n```\n\n##### colorDisable\n\n**Type:** Array\n\n**Description:** n/a\n\n```cpp\ncolorDisable[] = {0.4,0.4,0.4,1};\n```\n\n##### colorSelect\n\n**Type:** Array\n\n**Description:** n/a\n\n```cpp\ncolorSelect[] = {0,0,0,1};\n```\n\n##### colorSelectedBg\n\n**Type:** Array\n\n**Description:** Color of the background when checkbox is in focus (doesn't matter if checked or not).\n\n```cpp\ncolorSelectedBg[] = {\"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.13])\",\"(profilenamespace getvariable ['GUI_BCG_RGB_G',0.54])\",\"(profilenamespace getvariable ['GUI_BCG_RGB_B',0.21])\",1};\n```\n\n##### colorText\n\n**Type:** Array\n\n**Description:** Color of the unchecked checkbox text\n\n```cpp\ncolorText[] = {0.4,0.4,0.4,1};\n```\n\n##### colorTextDisable\n\n**Type:** Array\n\n**Description:** n/a\n\n```cpp\ncolorTextDisable[] = {0.4,0.4,0.4,1};\n```\n\n##### colorTextSelect\n\n**Type:** Array\n\n**Description:** Color of the checked checkbox text\n\n```cpp\ncolorTextSelect[] = {0,0.8,0,1};\n```\n\n##### columns\n\n**Type:** Number\n\n**Description:** Amount of columns to arrange checkboxes into\n\n```cpp\ncolumns = 1;\n```\n\n#### R\n\n##### rows\n\n**Type:** Number\n\n**Description:** Amount of rows to arrange checkboxes into.\n\n```cpp\nrows = 1;\n```\n\n#### S\n\n##### strings\n\n**Type:** Array\n\n**Description:** Checkboxes texts to display\n\n```cpp\nstrings[] = {\"UNCHECKED\"};\n```\n\n#### T\n\n##### tooltips\n\n**Type:** Array\n\n**Description:** Tooltips for each checkbox.\n\n```cpp\ntooltips[] = {\"tip0\",\"tip1\",\"tip2\",\"tip3\",\"tip4\",\"tip5\",\"tip6\",\"tip7\",\"tip8\",\"tip9\",\"tip10\",\"tip11\",\"tip12\",\"tip13\",\"tip14\",\"tip15\",\"tip16\",\"tip17\",\"tip18\",\"tip19\",\"tip20\",\"tip21\",\"tip22\",\"tip23\",\"tip24\",\"tip25\",\"tip26\",\"tip27\",\"tip28\",\"tip29\",\"tip30\",\"tip31\"};;\n```\n\n#### V\n\n##### values\n\n**Type:** Array\n\n**Description:** Numerical values associated with items. Can be retrieved or set with lbValue and lbSetValue.\n\n```cpp\nvalues[] = {1,2,3,4};\n```\n\n### Default Classes\n\n> [!NOTE]\n> **Arma 3:** **AddOns:** Classes need to be initialised first with `class SomeClass;`\n>\n> ---\n>\n> **Missions:** Since Arma 3 v2.02 one can use `import SomeClass;` to initialise a class (see the import keyword).\n>\n> In older versions, use `\"Default\" call BIS_fnc_exportGUIBaseClasses;` and paste the result into the description.ext.\n\nNeither the export nor the configFile contains a base class for this control type.\n\n### Example Classes\n\n```cpp\nclass MyCheckBoxes\n{\n    onLoad = \"_this select 0 ctrlSetChecked [1, true]; _this select 0 ctrlSetChecked [7, true]; _this select 0 ctrlSetChecked [15, true];\";\n\n    idc = -1;\n    type = 7; // CT_CHECKBOXES\n    style = 2; // ST_CENTER\n\n    x = 0.25;\n    y = 0.25;\n    w = 0.5;\n    h = 0.5;\n\n    colorText[] = {0, 1, 0, 1};\n    colorTextSelect[] = {1, 0, 0, 1};\n\n    colorBackground[] = {0, 0, 1, 0.3};\n    colorSelectedBg[] = {0, 0, 0, 0.2};\n\n    font = \"RobotoCondensed\";\n    sizeEx = 0.04;\n\n    onCheckBoxesSelChanged = \"hint str _this\";\n\n    columns = 8;\n    rows = 4;\n\n    strings[] = {\"0\",\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"10\",\"11\",\"12\",\"13\",\"14\",\"15\",\"16\",\"17\",\"18\",\"19\",\"20\",\"21\",\"22\",\"23\",\"24\",\"25\",\"26\",\"27\",\"28\",\"29\",\"30\",\"31\"};\n    checked_strings[] = {\"[0]\",\"[1]\",\"[2]\",\"[3]\",\"[4]\",\"[5]\",\"[6]\",\"[7]\",\"[8]\",\"[9]\",\"[10]\",\"[11]\",\"[12]\",\"[13]\",\"[14]\",\"[15]\",\"[16]\",\"[17]\",\"[18]\",\"[19]\",\"[20]\",\"[21]\",\"[22]\",\"[23]\",\"[24]\",\"[25]\",\"[26]\",\"[27]\",\"[28]\",\"[29]\",\"[30]\",\"[31]\"};\n    values[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31};\n    tooltips[] = {\"tip0\",\"tip1\",\"tip2\",\"tip3\",\"tip4\",\"tip5\",\"tip6\",\"tip7\",\"tip8\",\"tip9\",\"tip10\",\"tip11\",\"tip12\",\"tip13\",\"tip14\",\"tip15\",\"tip16\",\"tip17\",\"tip18\",\"tip19\",\"tip20\",\"tip21\",\"tip22\",\"tip23\",\"tip24\",\"tip25\",\"tip26\",\"tip27\",\"tip28\",\"tip29\",\"tip30\",\"tip31\"};\n};\n```","sections":[{"heading":"Introduction","level":3,"markdown":"The Checkboxes (also known as textual checkboxes) are a set of state change buttons, ordered by columns and rows. Unlike the Toolbox Control more than one button can become active. Maximum number of checkboxes available for a single control is 32. It is possible to create more than 32 checkboxes, however over-the-limit checkboxes will just become duplicates. `CT_CHECKBOXES` fully inherits from CT_TOOLBOX, the difference is that with CheckBoxes one can make multiple selections or have no item selected. When CheckBoxes style is `ST_PICTURE`, the `strings` property is treated as array of textures, and `checked_strings` property is ignored."},{"heading":"Related commands & functions","level":4,"markdown":"- Commands: General\n- Commands: UI Eventhandlers\n- Commands: Listbox\n- ctrlSetChecked\n- ctrlChecked"},{"heading":"Related User Interface Eventhandlers","level":4,"markdown":"- Events: General\n- Events: Listbox\n- Events: Checkbox"},{"heading":"Alphabetical Order","level":3,"markdown":"> [!NOTE]\n> TokenNames common to most controls, such as x, y, w, h, text, idc... can be found **here**.\n\n> [!WARNING]\n> Not all of the listed attributes might have an effect nor might the list be complete. All attributes were gathered with [this](https://github.com/7erra/BIKI.VR/blob/master/fnc/generateCTPage.sqf) config crawler.\n\n```cpp\n#define CT_CHECKBOXES 7\n```"},{"heading":"C","level":4,"markdown":""},{"heading":"checked_strings","level":5,"markdown":"**Type:** Array\n\n**Description:** Checkboxes texts to display when checkboxes are checked\n\n```cpp\nchecked_strings[] = {\"CHECKED\"};\n```"},{"heading":"color","level":5,"markdown":"**Type:** Array\n\n**Description:** n/a\n\n```cpp\ncolor[] = {0,0,0,0};\n```"},{"heading":"colorBackground","level":5,"markdown":"**Type:** Array\n\n**Description:** Color of the background when checkbox is not in focus (doesn't matter if checked or not).\n\n```cpp\ncolorBackground[] = {0,0,0,0};\n```"},{"heading":"colorDisable","level":5,"markdown":"**Type:** Array\n\n**Description:** n/a\n\n```cpp\ncolorDisable[] = {0.4,0.4,0.4,1};\n```"},{"heading":"colorSelect","level":5,"markdown":"**Type:** Array\n\n**Description:** n/a\n\n```cpp\ncolorSelect[] = {0,0,0,1};\n```"},{"heading":"colorSelectedBg","level":5,"markdown":"**Type:** Array\n\n**Description:** Color of the background when checkbox is in focus (doesn't matter if checked or not).\n\n```cpp\ncolorSelectedBg[] = {\"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.13])\",\"(profilenamespace getvariable ['GUI_BCG_RGB_G',0.54])\",\"(profilenamespace getvariable ['GUI_BCG_RGB_B',0.21])\",1};\n```"},{"heading":"colorText","level":5,"markdown":"**Type:** Array\n\n**Description:** Color of the unchecked checkbox text\n\n```cpp\ncolorText[] = {0.4,0.4,0.4,1};\n```"},{"heading":"colorTextDisable","level":5,"markdown":"**Type:** Array\n\n**Description:** n/a\n\n```cpp\ncolorTextDisable[] = {0.4,0.4,0.4,1};\n```"},{"heading":"colorTextSelect","level":5,"markdown":"**Type:** Array\n\n**Description:** Color of the checked checkbox text\n\n```cpp\ncolorTextSelect[] = {0,0.8,0,1};\n```"},{"heading":"columns","level":5,"markdown":"**Type:** Number\n\n**Description:** Amount of columns to arrange checkboxes into\n\n```cpp\ncolumns = 1;\n```"},{"heading":"R","level":4,"markdown":""},{"heading":"rows","level":5,"markdown":"**Type:** Number\n\n**Description:** Amount of rows to arrange checkboxes into.\n\n```cpp\nrows = 1;\n```"},{"heading":"S","level":4,"markdown":""},{"heading":"strings","level":5,"markdown":"**Type:** Array\n\n**Description:** Checkboxes texts to display\n\n```cpp\nstrings[] = {\"UNCHECKED\"};\n```"},{"heading":"T","level":4,"markdown":""},{"heading":"tooltips","level":5,"markdown":"**Type:** Array\n\n**Description:** Tooltips for each checkbox.\n\n```cpp\ntooltips[] = {\"tip0\",\"tip1\",\"tip2\",\"tip3\",\"tip4\",\"tip5\",\"tip6\",\"tip7\",\"tip8\",\"tip9\",\"tip10\",\"tip11\",\"tip12\",\"tip13\",\"tip14\",\"tip15\",\"tip16\",\"tip17\",\"tip18\",\"tip19\",\"tip20\",\"tip21\",\"tip22\",\"tip23\",\"tip24\",\"tip25\",\"tip26\",\"tip27\",\"tip28\",\"tip29\",\"tip30\",\"tip31\"};;\n```"},{"heading":"V","level":4,"markdown":""},{"heading":"values","level":5,"markdown":"**Type:** Array\n\n**Description:** Numerical values associated with items. Can be retrieved or set with lbValue and lbSetValue.\n\n```cpp\nvalues[] = {1,2,3,4};\n```"},{"heading":"Default Classes","level":3,"markdown":"> [!NOTE]\n> **Arma 3:** **AddOns:** Classes need to be initialised first with `class SomeClass;`\n>\n> ---\n>\n> **Missions:** Since Arma 3 v2.02 one can use `import SomeClass;` to initialise a class (see the import keyword).\n>\n> In older versions, use `\"Default\" call BIS_fnc_exportGUIBaseClasses;` and paste the result into the description.ext.\n\nNeither the export nor the configFile contains a base class for this control type."},{"heading":"Example Classes","level":3,"markdown":"```cpp\nclass MyCheckBoxes\n{\n    onLoad = \"_this select 0 ctrlSetChecked [1, true]; _this select 0 ctrlSetChecked [7, true]; _this select 0 ctrlSetChecked [15, true];\";\n\n    idc = -1;\n    type = 7; // CT_CHECKBOXES\n    style = 2; // ST_CENTER\n\n    x = 0.25;\n    y = 0.25;\n    w = 0.5;\n    h = 0.5;\n\n    colorText[] = {0, 1, 0, 1};\n    colorTextSelect[] = {1, 0, 0, 1};\n\n    colorBackground[] = {0, 0, 1, 0.3};\n    colorSelectedBg[] = {0, 0, 0, 0.2};\n\n    font = \"RobotoCondensed\";\n    sizeEx = 0.04;\n\n    onCheckBoxesSelChanged = \"hint str _this\";\n\n    columns = 8;\n    rows = 4;\n\n    strings[] = {\"0\",\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"10\",\"11\",\"12\",\"13\",\"14\",\"15\",\"16\",\"17\",\"18\",\"19\",\"20\",\"21\",\"22\",\"23\",\"24\",\"25\",\"26\",\"27\",\"28\",\"29\",\"30\",\"31\"};\n    checked_strings[] = {\"[0]\",\"[1]\",\"[2]\",\"[3]\",\"[4]\",\"[5]\",\"[6]\",\"[7]\",\"[8]\",\"[9]\",\"[10]\",\"[11]\",\"[12]\",\"[13]\",\"[14]\",\"[15]\",\"[16]\",\"[17]\",\"[18]\",\"[19]\",\"[20]\",\"[21]\",\"[22]\",\"[23]\",\"[24]\",\"[25]\",\"[26]\",\"[27]\",\"[28]\",\"[29]\",\"[30]\",\"[31]\"};\n    values[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31};\n    tooltips[] = {\"tip0\",\"tip1\",\"tip2\",\"tip3\",\"tip4\",\"tip5\",\"tip6\",\"tip7\",\"tip8\",\"tip9\",\"tip10\",\"tip11\",\"tip12\",\"tip13\",\"tip14\",\"tip15\",\"tip16\",\"tip17\",\"tip18\",\"tip19\",\"tip20\",\"tip21\",\"tip22\",\"tip23\",\"tip24\",\"tip25\",\"tip26\",\"tip27\",\"tip28\",\"tip29\",\"tip30\",\"tip31\"};\n};\n```"}],"categories":["Control Types"],"groups":["GUI"]}