Combobox mit Button verknüpfen

  • Heyho Leute ;)
    Ich bräuchte da mal eure Hilfe.
    Und zwar möchte ich das wenn man auf den Button GO klicklt geprüft wird welches Item gerde in der Combobox asugewählt ist und das dann startet. Allerdings ist mir das bis jetzt missglückt ;(
    Hier der Code

    [autoit]

    #include <GUIConstants.au3>

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

    $Form_Mstsc = GUICreate("Remotedesktop Tool", 364, 36, -1, -1)
    $Button_GO = GUICtrlCreateButton("GO", 304, 8, 49, 22, 0)
    $Combo_Auswahl = GUICtrlCreateCombo("Bitte eine Auswahl treffen" , 8, 8, 289, 25)
    GUICtrlSetData(-1, "Remote Root|Remote PC", "item3")
    GUISetState(@SW_SHOW)

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Button_GO
    If $Button_GO == "Bitte eine Auswahl treffen" then run("C:\Programme\Icq6.5\icq.exe")
    EndSwitch
    WEnd

    [/autoit]

    Einmal editiert, zuletzt von Nischlas (31. Juli 2009 um 23:43)


  • GUICtrlRead ist dein Freund. 8)

  • Das hat mir nun leider nicht wirklich weiter geholfen.. Ja ich habe schon in der Hilfe nachgeschaut un die Sufu benutzt.

  • Spoiler anzeigen
    [autoit]

    #include <GUIConstants.au3>

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

    $Form_Mstsc = GUICreate("Remotedesktop Tool", 364, 36, -1, -1)
    $Button_GO = GUICtrlCreateButton("GO", 304, 8, 49, 22, 0)
    $Combo_Auswahl = GUICtrlCreateCombo("Bitte eine Auswahl treffen", 8, 8, 289, 25)
    GUICtrlSetData(-1, "Remote Root|Remote PC", "item3")
    GUISetState(@SW_SHOW)

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Button_GO
    $Auswahl = GUICtrlRead($Combo_Auswahl)
    Switch $Auswahl
    Case "Bitte eine Auswahl treffen"
    MsgBox(0, "", $Auswahl)
    ;~ run("C:\Programme\Icq6.5\icq.exe")
    Case "Remote Root"
    MsgBox(0, "", $Auswahl)
    ;~ run("C:\Programme\Icq6.5\icq.exe")
    Case "Remote PC"
    MsgBox(0, "", $Auswahl)
    ;~ run("C:\Programme\Icq6.5\icq.exe")
    EndSwitch
    EndSwitch
    WEnd

    [/autoit]