FlatX007
Если элементов много, то можно создать массив с этими элементами:
Код:
![Выделить весь код](images/misc/selectcode.png)
#include <GuiConstantsEx.au3>
Global $aButton[12]
Dim $iLeft = 11, $iTop = 11
$hGUI = GUICreate("Test GUI", 269, 200)
For $i = 0 To UBound($aButton) - 1
$aButton[$i] = GUICtrlCreateButton("Button " & $i + 1, $iLeft, $iTop, 75, 23)
$iLeft += 85
If $iLeft >= 200 Then
$iLeft = 11
$iTop += 30
EndIf
Next
$cButton_EnableDisable = GUICtrlCreateButton("Disable", 11, 166, 75, 23)
GUISetState()
While 1
$msg = GUIGetMsg()
Switch $msg
Case $GUI_EVENT_CLOSE
Exit
Case $cButton_EnableDisable
If GUICtrlRead($cButton_EnableDisable) = "Disable" Then
_ControlEnableDisableEx($aButton, 0)
GUICtrlSetData($cButton_EnableDisable, "Enable")
Else
_ControlEnableDisableEx($aButton, 1)
GUICtrlSetData($cButton_EnableDisable, "Disable")
EndIf
EndSwitch
WEnd
Func _ControlEnableDisableEx($aControls, $iState = 1)
Local $nState = $GUI_ENABLE
If $iState = 0 Then $nState = $GUI_DISABLE
For $i = 0 To UBound($aControls) - 1
GUICtrlSetState($aControls[$i], $nState)
Next
EndFunc ;==>_ControlEnableDisable