mehrere GuiCtrlSetOnEvent für eine Combobox

  • Hallo

    Ich hab ein Problem damit zwei Funktionen via GuiCtrlSetOnEvent auszulösen, sobald der Benutzer etwas aus einer Combobox auswählt.

    Beide Funktionen funktionieren, leider aber nur immer EINE davon so wie vorgesehen bei dem Event.

    Kann ich den Event nur einmal abfangen, bzw. kann ein Event nur eine Funktion auslösen !?

    Mfg

    Philipp

    Einmal editiert, zuletzt von Cerverus (15. Oktober 2010 um 11:39)

  • Spoiler anzeigen
    [autoit]

    #include <ButtonConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    Opt("GUIOnEventMode", 1)
    $Form1 = GUICreate("Form1", 200, 200)
    $Button1 = GUICtrlCreateButton("Button1", 16, 16, 75, 25, $WS_GROUP)
    GUICtrlSetOnEvent(-1, "_run")
    GUISetState(@SW_SHOW)

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

    While 1
    Sleep(100)
    WEnd

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

    Func _run()
    _eins()
    _zwei()
    EndFunc

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

    Func _eins()
    MsgBox(0, "", "eins")
    EndFunc

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

    Func _zwei()
    MsgBox(0, "", "zwei")
    EndFunc

    [/autoit]
  • Okay, danke schön. Wie ichs mir gedacht hab, den event kann mal nur einmal abfangen.

    Wiedermal ein großes Dankeschön für die schnelle und kompetente Hilfe.

  • Meinst du vielleicht sowas?

    [autoit]

    #include <ButtonConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    Opt("GUIOnEventMode", 1)
    $Form1 = GUICreate("Form1", 200, 200)
    $Button1 = GUICtrlCreateCombo("", 16, 16, 75, 25)
    GUICtrlSetData(-1, "Func1|Func2|Func3|Func4", "Func1")
    GUICtrlSetOnEvent(-1, "_Combofunc")
    GUISetState(@SW_SHOW)

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

    While 1
    Sleep(100)
    WEnd

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

    Func _Combofunc()
    Select
    Case GUICtrlRead($Button1) = "Func1"
    MsgBox(0, "1", "Func1")
    Case GUICtrlRead($Button1) = "Func2"
    MsgBox(0, "2", "Func2")
    Case GUICtrlRead($Button1) = "Func3"
    MsgBox(0, "3", "Func3")
    Case GUICtrlRead($Button1) = "Func4"
    MsgBox(0, "4", "Func4")
    EndSelect

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

    EndFunc ;==>_Combofunc

    [/autoit]