#include #include Opt("GUIOnEventMode", 1) Opt('MustDeclareVars', 1) Global $aBtnIds[10][2] $aBtnIds[0][1] = "func1" $aBtnIds[1][1] = "func2" $aBtnIds[2][1] = "func3" $aBtnIds[3][1] = "func4" $aBtnIds[4][1] = "func5" $aBtnIds[5][1] = "func6" $aBtnIds[6][1] = "func7" $aBtnIds[7][1] = "func8" $aBtnIds[8][1] = "func9" Global $hGui = GUICreate('CheckBoxtest', 105, 145) Global $msg For $i = 0 To 8 $aBtnIds[$i][0] = GUICtrlCreateCheckBox($i + 1, 10 + Mod($i, 3) * 30, 10 + Int($i / 3) * 30, 25, 25) GUICtrlSetOnEvent(-1, '_Click') ConsoleWrite($i + 1 & ': ' & $aBtnIds[$i][0] & @CRLF) Next $aBtnIds[9][0] = GUICtrlCreateButton('OK', 10, 110, 90, 25) ConsoleWrite('OK: ' & $aBtnIds[$i][0] & @CRLF) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlSetOnEvent(-1, '_Submit') GUISetOnEvent($GUI_EVENT_CLOSE,'_Exit') GUISetState() While 1 Sleep(10000) WEnd Func _Click() Local $iBtn = @GUI_CtrlId - $aBtnIds[0][0] ConsoleWrite($iBtn+1&' = '&'CtrlID: '&@GUI_CtrlId&@CRLF) Local $bAtLeastOneCheckBoxChecked For $i = 0 To 8 If BitAND(GUICtrlRead($aBtnIds[$i][0]),$GUI_checked)=$GUI_checked Then $bAtLeastOneCheckBoxChecked = True ExitLoop EndIf Next If $bAtLeastOneCheckBoxChecked Then GUICtrlSetState($aBtnIds[9][0], $GUI_ENABLE) Else GUICtrlSetState($aBtnIds[9][0], $GUI_DISABLE) EndIf EndFunc ;==>_Click Func _Submit() Local $sFunc='' For $i = 0 To 8 If BitAND(GUICtrlRead($aBtnIds[$i][0]),$GUI_checked)=$GUI_checked Then Call($aBtnIds[$i][1]) $sFunc&=$aBtnIds[$i][1]&'|' EndIf Next $sFunc=StringTrimRight($sFunc,1) ConsoleWrite('Funcs are called: '&$sFunc&@CRLF&@CRLF) EndFunc ;==>_Submit Func _exit() Exit EndFunc Func Func1() MsgBox(0,'Func1','was called',5) EndFunc Func Func2() MsgBox(0,'Func2','was called',5) EndFunc Func Func3() MsgBox(0,'Func3','was called',5) EndFunc Func Func4() MsgBox(0,'Func4','was called',5) EndFunc Func Func5() MsgBox(0,'Func5','was called',5) EndFunc Func Func6() MsgBox(0,'Func6','was called',5) EndFunc Func Func7() MsgBox(0,'Func7','was called',5) EndFunc Func Func8() MsgBox(0,'Func8','was called',5) EndFunc Func Func9() MsgBox(0,'Func9','was called',5) EndFunc