{"name":"ctrlEnable","title":"ctrlEnable","type":"command","url":"https://community.bistudio.com/wiki/ctrlEnable","revid":364166,"updated":"2024-05-05T10:46:43Z","groups":["GUI Control"],"status":"ok","games":{"ofp":"1.75","ofpe":"1.00","arma1":"1.00","arma2":"1.00","arma2oa":"1.50","tkoh":"1.00","arma3":"0.50"},"since":"ofp 1.75","arma3_since":"0.50","locality":{"argument":"local","effect":"local"},"description":"Enables or disables a control of the currently active user dialog.\nDisabled controls cannot be clicked onto.\nRead Arma: GUI Configuration for more information about user dialogs and controls.","syntaxes":[{"syntax":"ctrlEnable [idc, enable]","params":[{"name":"idc","type":"Number","description":"control IDC","type_expr":"Number"},{"name":"enable","type":"Boolean","description":"true to enable the control, false to disable it","type_expr":"Boolean"}],"returns":{"type":"Nothing","type_expr":"Nothing"},"form":"unary","right":{"text":"[idc, enable]"}},{"syntax":"controlName ctrlEnable enable","params":[{"name":"controlName","type":"Control","type_expr":"Control"},{"name":"enable","type":"Boolean","type_expr":"Boolean"}],"returns":{"type":"Nothing","type_expr":"Nothing"},"form":"binary","left":{"text":"controlName"},"right":{"text":"enable"}}],"examples":[{"code":["ctrlEnable [100, false];"]},{"code":["_ctrl ctrlEnable false;"]}],"see_also":["ctrlEnabled"],"notes":[{"user":"Yuval","date":"2017-07-20T11:59:00Z","text":"Please do note that enabled controls can gain focus upon click. Therefore do not enable background controls or else they will cover any controls on top of them.\nAs a general rule of thumb, enabled controls should only be already on the top of the GUI."},{"user":"R3vo","date":"2020-09-07T22:26:00Z","text":"One can disable a control when it is loaded by using ctrlEnable in the onLoad event handler.\n\n```cpp\nclass MyDialog\n{\n    class MyControl\n    {\n        onLoad = \"(_this # 0) ctrlEnable false;\";\n    };\n};\n```"}]}