GuiButtons in einem Array deklariert - Gui event mit schleife für buttonabfrage?

  • Hiho

    nächtes prob. ich denkmal der titel ist nciht so ganz klar ^^

    Meine buttons hab ich so deklariert

    Spoiler anzeigen

    Do
    $verk1[$counter] = GUICtrlCreateButton ($buttonname[$counter], 100, $button_pos, 80)
    $button_pos = $button_pos + 30
    $counter = $counter + 1
    Until $counter > 14

    meine eventabfrage so

    Spoiler anzeigen

    While 1
    $msg = GUIGetMsg(1)
    Select
    Case $msg[0] = $verk1[?]
    ;~ $tmpbutton1 = String ($tmpbutton)
    ;~ IF LABEL = "" DANN HINWEIS AUF NICHTS ELSE PROGSTART
    ;~ $tmppfad = IniRead(@scriptdir & "\verk\verk_pfade.ini", "Verknüpfung 1", $labelname[0] , "default" )
    ;~ Run($tmppfad)
    MsgBox(0, "asdfasdf" ," ")

    Case $msg[0] = $neu
    _verkvergleich()

    Case $msg[0] = $formatieren
    _formatieren()

    Case $msg[0] = $info
    $gui_info = GUICreate ( "Infos" , 400 , 400 , 10 , 10 )
    _info()
    GUISetState(@SW_SHOW, $gui_info)

    Case $msg[0] = $GUI_EVENT_CLOSE And $msg[1] = $gui_main
    ExitLoop

    Case $msg[0] = $GUI_EVENT_CLOSE And $msg[1] = $gui_info
    GUIDelete($gui_info)

    EndSelect
    WEnd

    so etz möcht ich aber ned 15 mal Case $msg[0] = $verk1[?] definieren und das muss ja irgendwie auch inner schleife gehen...
    nur wie? :D

    • Offizieller Beitrag

    Mach es doch so:

    Spoiler anzeigen
    [autoit]

    #include <guiconstants.au3>
    Opt('GUIOnEventMode', 1)
    Dim $verk1[15], $counter = 0, $button_pos = 10
    GUICreate('', 600, 500, -1, -1)
    GUISetOnEvent($GUI_EVENT_CLOSE, '_ende')
    Do
    $verk1[$counter] = GUICtrlCreateButton ('Button' & $counter+1, 100, $button_pos, 80)
    GUICtrlSetOnEvent($verk1[$counter], '_FuncButt' & $counter+1)
    $button_pos += 30
    $counter += 1
    Until $counter > 14

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

    GUISetState()

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

    While 1
    Sleep(100)
    WEnd

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

    Func _ende()
    Exit
    EndFunc

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

    Func _FuncButt1()
    MsgBox(0, '', 'Button1')
    EndFunc
    Func _FuncButt2()
    MsgBox(0, '', 'Button2')
    EndFunc
    Func _FuncButt3()
    MsgBox(0, '', 'Button3')
    EndFunc
    Func _FuncButt4()
    MsgBox(0, '', 'Button4')
    EndFunc
    Func _FuncButt5()
    MsgBox(0, '', 'Button5')
    EndFunc
    Func _FuncButt6()
    MsgBox(0, '', 'Button6')
    EndFunc
    Func _FuncButt7()
    MsgBox(0, '', 'Button7')
    EndFunc
    Func _FuncButt8()
    MsgBox(0, '', 'Button8')
    EndFunc
    Func _FuncButt9()
    MsgBox(0, '', 'Button9')
    EndFunc
    Func _FuncButt10()
    MsgBox(0, '', 'Button10')
    EndFunc
    Func _FuncButt11()
    MsgBox(0, '', 'Button11')
    EndFunc
    Func _FuncButt12()
    MsgBox(0, '', 'Button12')
    EndFunc
    Func _FuncButt13()
    MsgBox(0, '', 'Button13')
    EndFunc
    Func _FuncButt14()
    MsgBox(0, '', 'Button14')
    EndFunc
    Func _FuncButt15()
    MsgBox(0, '', 'Button15')
    EndFunc

    [/autoit]