{"name":"ctrlEnable","operator":null,"title":"ctrlEnable","type":"command","url":"https://community.bistudio.com/wiki/ctrlEnable","revid":364166,"updated":"2024-05-05T10:46:43Z","groups":["GUI Control"],"status":"ok","replaced_by":[],"games":[{"game":"ofp","name":"Operation Flashpoint","version":"1.75"},{"game":"ofpe","name":"Operation Flashpoint: Elite","version":"1.00"},{"game":"arma1","name":"Armed Assault","version":"1.00"},{"game":"arma2","name":"Arma 2","version":"1.00"},{"game":"arma2oa","name":"Arma 2: Operation Arrowhead","version":"1.50"},{"game":"tkoh","name":"Take On Helicopters","version":"1.00"},{"game":"arma3","name":"Arma 3","version":"0.50"}],"since":{"game":"ofp","name":"Operation Flashpoint","version":"1.75"},"arma3_since":"0.50","branch":null,"locality":{"argument":"local","effect":"local","server_exec":false},"exec":null,"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]","since":null,"effect":null,"exec":null,"params":[{"name":"idc","type":"Number","optional":false,"default":null,"description":"control IDC","types":["Number"],"since":null,"text":"idc: Number - control IDC"},{"name":"enable","type":"Boolean","optional":false,"default":null,"description":"true to enable the control, false to disable it","types":["Boolean"],"since":null,"text":"enable: Boolean - true to enable the control, false to disable it"}],"returns":{"type":"Nothing","types":["Nothing"],"description":null,"text":"Nothing"},"form":"unary","operator":null,"left":null,"right":{"text":"[idc, enable]","types":["Array"]}},{"syntax":"controlName ctrlEnable enable","since":null,"effect":null,"exec":null,"params":[{"name":"controlName","type":"Control","optional":false,"default":null,"description":null,"types":["Control"],"since":null,"text":"controlName: Control"},{"name":"enable","type":"Boolean","optional":false,"default":null,"description":null,"types":["Boolean"],"since":null,"text":"enable: Boolean"}],"returns":{"type":"Nothing","types":["Nothing"],"description":null,"text":"Nothing"},"form":"binary","operator":null,"left":{"text":"controlName","types":["Control"]},"right":{"text":"enable","types":["Boolean"]}}],"examples":[{"text":"```sqf\nctrlEnable [100, false];\n```","code":["ctrlEnable [100, false];"]},{"text":"```sqf\n_ctrl ctrlEnable false;\n```","code":["_ctrl ctrlEnable false;"]}],"multiplayer":null,"problems":null,"aliases":[],"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.\n\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```"}],"categories":[]}