cbChecked is always returning false, regardless what the state an rscTextCheckBox actually is in. Additionally, cbSetChecked also does not produce any change to the state of a rscTextCheckBox.
Description
Details
- Legacy ID
- 910288770
- Severity
- None
- Resolution
- No Bug
- Reproducibility
- Always
- Category
- Scripting
See code in additional information. Note that '_this select 2' passed from ctrlSetEventHandler shows that the state of the checkbox is changing, yet cbChecked shows false no matter what.
class M_RscTextCheckbox
{
idc = -1;
type = CT_CHECKBOXES;
style = ST_CENTER;
font = "PuristaBold";
sizeEx = 0.024;
x = 0;
y = 0;
w = 0.2;
h = 0.2;
color[] = {0.14,0.14,0.14,1};
colorSelect[] = {0.72,0.73,0.73,1};
colorTextDisable[] = {0.92,0.74,0.13,0.5};
colorDisable[] = {0.72,0.73,0.73,1};
colorText[] = {0.72,0.73,0.73,1};
colorTextSelect[] = {0.92,0.74,0.13,1};
colorSelectedBg[] = {0.14,0.14,0.14,1};
rows = 1;
columns = 1;
strings[] = {"OFF"};
checked_strings[] = {"ON"};
};
class M_Dialog
{
idd = 101010;
movingEnable = true;
class controls
{
class M_Make_Sign: M_RscTextCheckbox { idc = 11111; x = 25 * GUI_GRID_W + GUI_GRID_X; y = 21.25 * GUI_GRID_H + GUI_GRID_Y; w = 6 * GUI_GRID_W; h = 1 * GUI_GRID_H; strings[] = {"No Sign"}; checked_strings[] = {"Make Sign"}; toolTip = "'Make Sign' creates a sign"; };
};
};
_disp = findDisplay 101010;
_ctrl = _disp displayCtrl 11111;
_ctrl ctrlSetEventHandler ["CheckBoxesSelChanged", "_this call EH_CB_Make_Sign_Changed"];
EH_CB_Make_Sign_Changed =
{
_ctrl = _this select 0;
_checked = cbChecked _ctrl;
systemChat (str _checked);
systemChat (str _this);
};
Event Timeline
cbChecked and cbSetChecked is for the new checkboxes (type = 77).
for the (old) textual checkboxes (type = 7) use https://community.bistudio.com/wiki/ctrlChecked and https://community.bistudio.com/wiki/ctrlSetChecked