Hier ein altes Bsp. von mir:
Spoiler anzeigen
#include <GUIConstantsEx.au3>
Global $arRadio[10], $str
$gui = GUICreate('test', 500, 400)
GUICtrlCreateGroup('', 10, 10, 400, 60)
$arRadio[0] = GUICtrlCreateRadio('Radio 1', 20, 20, 70)
$arRadio[1] = GUICtrlCreateRadio('Radio 2', 20, 45, 70)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlCreateGroup('', 10, 80, 400, 60)
$arRadio[2] = GUICtrlCreateRadio('Radio 3', 20, 90, 70)
$arRadio[3] = GUICtrlCreateRadio('Radio 4', 20, 115, 70)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlCreateGroup('', 10, 150, 400, 60)
$arRadio[4] = GUICtrlCreateRadio('Radio 5', 20, 160, 70)
$arRadio[5] = GUICtrlCreateRadio('Radio 6', 20, 185, 70)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlCreateGroup('', 10, 220, 400, 60)
$arRadio[6] = GUICtrlCreateRadio('Radio 7', 20, 230, 70)
$arRadio[7] = GUICtrlCreateRadio('Radio 8', 20, 255, 70)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlCreateGroup('', 10, 290, 400, 60)
$arRadio[8] = GUICtrlCreateRadio('Radio 9', 20, 300, 70)
$arRadio[9] = GUICtrlCreateRadio('Radio 10', 20, 325, 70)
GUICtrlCreateGroup("", -99, -99, 1, 1)
For $i = 0 To UBound($arRadio) -2 Step 2
GUICtrlSetState($arRadio[$i], $GUI_CHECKED)
Next
$bCheck = GUICtrlCreateButton('Check', 10, 370, 60, 20)
GUISetState()
Do
$msg = GUIGetMsg()
If $msg = $bCheck Then
$str = ''
For $i = 0 To UBound($arRadio) -1
If BitAND(GUICtrlRead($arRadio[$i]), $GUI_CHECKED) Then
$str &= ControlGetText("", "", $arRadio[$i]) & @LF
EndIf
Next
MsgBox(0, '', 'Markiert sind: ' & @LF & $str )
EndIf
Until $msg = $GUI_EVENT_CLOSE
Edit:
Hatte mich vertan, du wolltest ja Checkboxen - dann dieses:
Spoiler anzeigen
#include <GUIConstants.au3>
Opt('GUIOnEventMode', 1)
Global $gui, $aCB[10]
Local $y = 20
$gui = GUICreate('Test')
GUISetOnEvent(-3, '_ende')
GUICtrlCreateGroup('', 10, 5, 100, 220)
For $i = 0 To UBound($aCB) -1
$aCB[$i] = GUICtrlCreateCheckbox('CheckBox '&$i+1, 20, $y, 70)
GUICtrlSetOnEvent(-1, '_CBClick')
$y += 20
Next
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState()
[/autoit] [autoit][/autoit] [autoit]While True
Sleep(100)
WEnd
Func _ende()
Exit
EndFunc
Func _CBClick()
For $i = 0 To UBound($aCB) -1
If @GUI_CtrlId = $aCB[$i] Then
If BitAND(GUICtrlRead($aCB[$i]), $GUI_CHECKED) Then
MsgBox(0, ControlGetText($gui, '', $aCB[$i]), 'CB Checked')
Else
MsgBox(0, ControlGetText($gui, '', $aCB[$i]), 'CB Not Checked')
EndIf
ExitLoop
EndIf
Next
EndFunc