Mehrere checkboxen auslesen und inhal auflisten

  • hallo,
    ich hab folgendes problem:

    Spoiler anzeigen
    [autoit]

    $Form2 = GUICreate("Form1", 419, 453, 342, 178)
    $Checkbox1 = GUICtrlCreateCheckbox("a", 16, 64, 385, 17)
    $Checkbox2 = GUICtrlCreateCheckbox("b", 16, 40, 385, 17)
    $Checkbox3 = GUICtrlCreateCheckbox("c", 16, 88, 385, 17)
    $Checkbox4 = GUICtrlCreateCheckbox("d", 16, 16, 385, 17)
    $Checkbox5 = GUICtrlCreateCheckbox("e", 16, 160, 385, 17)
    $Checkbox6 = GUICtrlCreateCheckbox("f", 16, 136, 385, 17)
    $Checkbox7 = GUICtrlCreateCheckbox("g", 16, 184, 385, 17)
    $Checkbox8 = GUICtrlCreateCheckbox("h", 16, 112, 385, 17)
    $Checkbox9 = GUICtrlCreateCheckbox("i", 16, 256, 385, 17)
    $Checkbox10 = GUICtrlCreateCheckbox("j", 16, 232, 385, 17)
    $Checkbox11 = GUICtrlCreateCheckbox("k", 16, 280, 385, 17)
    $Checkbox12 = GUICtrlCreateCheckbox("l", 16, 208, 385, 17)
    $Checkbox13 = GUICtrlCreateCheckbox("m", 16, 352, 385, 17)
    $Checkbox14 = GUICtrlCreateCheckbox("n", 16, 328, 385, 17)
    $Checkbox15 = GUICtrlCreateCheckbox("o", 16, 304, 385, 17)
    $Button2 = GUICtrlCreateButton("OK", 32, 392, 65, 33, $WS_GROUP)
    GUISetState(@SW_SHOW)

    [/autoit]


    ich will nun ,dass er mir allses in einen string pack...
    in z.b. dem format:

    m,a,c,f,e
    der string der checkbox kann sich änder..

    Jura

  • [autoit]

    $Variable = GUICtrlRead($Checkbox1)&GUICtrlRead($Checkbox2)&...

    [/autoit]


    So ?

    • Offizieller Beitrag

    ControlGetText ist das Zauberwort. :)

    Ich hab's mal schnell geschrieben:

    Spoiler anzeigen
    [autoit]


    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>

    [/autoit] [autoit][/autoit] [autoit]

    $Form2 = GUICreate("Form1", 419, 453, 342, 178)
    Dim $ahCheckbox[15]
    For $i = 0 To UBound($ahCheckbox) - 1
    $ahCheckbox[$i] = GUICtrlCreateCheckbox(Chr(65 + $i), 16, 20 + $i * 24, 385, 17)
    Next
    $Button2 = GUICtrlCreateButton("OK", 32, 392, 65, 33, $WS_GROUP)
    GUISetState(@SW_SHOW)
    While True
    Switch GUIGetMsg()
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Button2
    $sOutput = ''
    For $i = 0 To UBound($ahCheckbox) - 1
    If BitAND(GUICtrlRead($ahCheckbox[$i]), $GUI_CHECKED) Then $sOutput &= ControlGetText($Form2, '', $ahCheckbox[$i]) & ','
    Next
    MsgBox(0, 'Ausgabe', $sOutput)
    EndSwitch
    WEnd

    [/autoit]
  • Hallo JuraX,

    du musst den advanced Parameter verwenden

    Zitat von Hilfe

    GUICtrlRead ( controlID [, advanced] )
    ..
    Bemerkungen

    Im "advanced" Modus enthält der Rückgabewert zusätzliche Daten des Controls (siehe unten).

    Merke: nicht für alle bekannten Controls sind zusätzliche Daten verfügbar!

    Typ zusätzlicher Wert
    Checkbox, Radio Der Text des Controls.

    mfg (Auto)Bert

  • noch ne frage (wieso hab ich das noch nie gebraucht ?( )
    ich hab jetzt

    Spoiler anzeigen
    [autoit]

    Func CARSEL()
    $Form2 = GUICreate("Form1", 419, 453, 342, 178)
    Dim $ahCheckbox[15]
    For $i = 0 To UBound($ahCheckbox) - 1
    $ahCheckbox[$i] = GUICtrlCreateCheckbox(Chr(65 + $i), 16, 20 + $i * 24, 385, 17)
    Next
    $Button2 = GUICtrlCreateButton("OK", 32, 392, 65, 33, $WS_GROUP)
    GUISetState(@SW_SHOW)
    While True
    Switch GUIGetMsg()
    Case $GUI_EVENT_CLOSE
    WinClose("Form2")
    Case $Button2
    $sOutput = ''
    For $i = 0 To UBound($ahCheckbox) - 1
    If BitAND(GUICtrlRead($ahCheckbox[$i]), $GUI_CHECKED) Then $sOutput &= ControlGetText($Form2, '', $ahCheckbox[$i]) & ','
    Next
    Return $sOutput
    GUIDelete()
    EndSwitch
    WEnd
    EndFunc ;==>CARSEL

    [/autoit]


    aber egal was ich mache , ob guisetstate,guideleate,winclose...
    funktioniwert nicht...

  • noch ne frage (wieso hab ich das noch nie gebraucht ?( )
    ich hab jetzt

    Spoiler anzeigen
    [autoit]

    Func CARSEL()
    $Form2 = GUICreate("Form1", 419, 453, 342, 178)
    Dim $ahCheckbox[15]
    For $i = 0 To UBound($ahCheckbox) - 1
    $ahCheckbox[$i] = GUICtrlCreateCheckbox(Chr(65 + $i), 16, 20 + $i * 24, 385, 17)
    Next
    $Button2 = GUICtrlCreateButton("OK", 32, 392, 65, 33, $WS_GROUP)
    GUISetState(@SW_SHOW)
    While True
    Switch GUIGetMsg()
    Case $GUI_EVENT_CLOSE
    WinClose("Form2")
    Case $Button2
    $sOutput = ''
    For $i = 0 To UBound($ahCheckbox) - 1
    If BitAND(GUICtrlRead($ahCheckbox[$i]), $GUI_CHECKED) Then $sOutput &= ControlGetText($Form2, '', $ahCheckbox[$i]) & ','
    Next
    Return $sOutput
    GUIDelete()
    EndSwitch
    WEnd
    EndFunc ;==>CARSEL

    [/autoit]


    aber egal was ich mache , ob guisetstate,guidelete,winclose...
    funktioniwert nicht...