Combobox

  • Hai Leute,
    Ich hätte mal eine frage
    Ich habe auf einer gui eine Combobox.
    in diese gibt es drei auswahl möglich keiten.
    Nun möchte ich das wenn man eine auswählt eine Bestimmte funktion ausgeführt wird!
    das wichtige ist aber das er diese funktion nich stendig ausführt.(Ps: wegen checkboxen)
    sondern erst wieder eine andere funktion ausführt wenn etwas neues bzw. anders in der Combobox ausgewählt wird-....-


    MFG
    CF*Gaming

  • Ich habe es jetzt mal versucht und mit beiden Versionen nicht hin bekommen deshalb stehle ich jetzt mein Skript vor:

    [autoit]

    #include <ButtonConstants.au3>
    #include <ComboConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    Global $Checkbox1, $Checkbox2 , $Checkbox3 , $Checkbox4 , $Checkbox5 ,$Checkbox6 , $Checkbox7, $Checkbox8, $Checkbox9, $Checkbox10, $Checkbox11, $Checkbox12
    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Tranigsplan", 177, 212, 192, 124)
    $Combo1 = GUICtrlCreateCombo("", 8, 8, 145, 25)
    GUICtrlSetData(-1, "14:15 Laufen|19:00 Liegestütze|5:45 Liegstütze")
    $Button2 = GUICtrlCreateButton("Button1", 96, 160, 75, 25, $WS_GROUP)
    $Button1 = GUICtrlCreateButton("Button1", 88, 64, 75, 25, $WS_GROUP)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###
    IniWrite("Data.txt", "Checkboxen", "1", ""); Valvue 1= unchecked 2= checked
    While 1
    $iCombo = Guictrlread($Combo1)
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    EndSwitch
    WEnd

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

    Func _Liegestutze()
    GUICtrlDelete( $Checkbox8)
    GUICtrlDelete( $Checkbox9)
    GUICtrlDelete( $Checkbox10)
    GUICtrlDelete( $Checkbox11)
    GUICtrlDelete( $Checkbox12)
    $Checkbox1 = GUICtrlCreateCheckbox("10", 8, 40, 97, 17)
    $Checkbox2 = GUICtrlCreateCheckbox("15", 8, 64, 97, 17)
    $Checkbox3 = GUICtrlCreateCheckbox("20", 8, 88, 97, 17)
    $Checkbox4 = GUICtrlCreateCheckbox("25", 8, 112, 97, 17)
    $Checkbox5 = GUICtrlCreateCheckbox("30", 8, 136, 97, 17)
    $Checkbox6 = GUICtrlCreateCheckbox("35", 8, 160, 97, 17)
    $Checkbox7 = GUICtrlCreateCheckbox("40", 8, 184, 97, 17)
    EndFunc

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

    Func _Laufen()
    GUICtrlDelete( $Checkbox1)
    GUICtrlDelete( $Checkbox2)
    GUICtrlDelete( $Checkbox3)
    GUICtrlDelete( $Checkbox4)
    GUICtrlDelete( $Checkbox5)
    GUICtrlDelete( $Checkbox6)
    GUICtrlDelete( $Checkbox7)
    $Checkbox8 = GUICtrlCreateCheckbox("Waldrand(und zurück)", 8, 40, 97, 17)
    $Checkbox9 = GUICtrlCreateCheckbox("2x Waldrand(““)", 8, 64, 97, 17)
    $Checkbox10 = GUICtrlCreateCheckbox("3x ““", 8, 88, 97, 17)
    $Checkbox11 = GUICtrlCreateCheckbox("4x ““", 8, 112, 97, 17)
    $Checkbox12 = GUICtrlCreateCheckbox("In den Wald ", 8, 136, 97, 17)
    EndFunc

    [/autoit]


    Ich hoffe das hilft vlt. ein biscchen

  • Hallo [CF[*Gaming*],

    geht auch im Msg-Loop Modus, schau dir dazu [Beispiel] MiniUrl-Manager (kleiner Webseitenverwalter) er ist zu DEMO-Zwecken im Umgang von ComboBox und INI-Files geskriptet worden,

    Edit: und hier dein aktualisiertes Skript:

    Spoiler anzeigen
    [autoit]

    #include <ButtonConstants.au3>
    #include <ComboConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    Global $Checkbox1, $Checkbox2 , $Checkbox3 , $Checkbox4 , $Checkbox5 ,$Checkbox6 , $Checkbox7, $Checkbox8, $Checkbox9, $Checkbox10, $Checkbox11, $Checkbox12
    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Tranigsplan", 177, 212, 192, 124)
    $Combo1 = GUICtrlCreateCombo("", 8, 8, 145, 25)
    GUICtrlSetData(-1, "14:15 Laufen|19:00 Liegestütze|5:45 Liegstütze")
    $Button2 = GUICtrlCreateButton("Button1", 96, 160, 75, 25, $WS_GROUP)
    $Button1 = GUICtrlCreateButton("Button1", 88, 64, 75, 25, $WS_GROUP)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###
    IniWrite("Data.txt", "Checkboxen", "1", ""); Valvue 1= unchecked 2= checked
    While 1
    $iCombo = Guictrlread($Combo1)
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Combo1
    $ToDo = GUICtrlRead($Combo1)
    Switch $ToDo
    Case "14:15 Laufen"
    _Laufen()
    Case "19:00 Liegestütze", "5:45 Liegstütze"
    _Liegestutze()
    EndSwitch
    EndSwitch
    WEnd

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

    Func _Liegestutze()
    GUICtrlDelete( $Checkbox8)
    GUICtrlDelete( $Checkbox9)
    GUICtrlDelete( $Checkbox10)
    GUICtrlDelete( $Checkbox11)
    GUICtrlDelete( $Checkbox12)
    $Checkbox1 = GUICtrlCreateCheckbox("10", 8, 40, 97, 17)
    $Checkbox2 = GUICtrlCreateCheckbox("15", 8, 64, 97, 17)
    $Checkbox3 = GUICtrlCreateCheckbox("20", 8, 88, 97, 17)
    $Checkbox4 = GUICtrlCreateCheckbox("25", 8, 112, 97, 17)
    $Checkbox5 = GUICtrlCreateCheckbox("30", 8, 136, 97, 17)
    $Checkbox6 = GUICtrlCreateCheckbox("35", 8, 160, 97, 17)
    $Checkbox7 = GUICtrlCreateCheckbox("40", 8, 184, 97, 17)
    EndFunc

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

    Func _Laufen()
    GUICtrlDelete( $Checkbox1)
    GUICtrlDelete( $Checkbox2)
    GUICtrlDelete( $Checkbox3)
    GUICtrlDelete( $Checkbox4)
    GUICtrlDelete( $Checkbox5)
    GUICtrlDelete( $Checkbox6)
    GUICtrlDelete( $Checkbox7)
    $Checkbox8 = GUICtrlCreateCheckbox("Waldrand(und zurück)", 8, 40, 97, 17)
    $Checkbox9 = GUICtrlCreateCheckbox("2x Waldrand(““)", 8, 64, 97, 17)
    $Checkbox10 = GUICtrlCreateCheckbox("3x ““", 8, 88, 97, 17)
    $Checkbox11 = GUICtrlCreateCheckbox("4x ““", 8, 112, 97, 17)
    $Checkbox12 = GUICtrlCreateCheckbox("In den Wald ", 8, 136, 97, 17)
    EndFunc

    [/autoit]

    mfg autoBert

    Einmal editiert, zuletzt von autoBert (16. November 2010 um 19:55)

  • [autoit]

    Case $Button1
    If GUICtrlRead($Combo1) = "14:15 Laufen" Then
    _Laufen()
    Else
    _Liegestutze()
    EndIf

    [/autoit]

    so in etwa, musst Du Dir halt weiter anpassen, aber so kommt wenigstens etwas Bewegung in die GUI :D


    Gruß Dietmar

    Achtung Anfänger! :whistling:

    Betrachten des Quellcodes auf eigene Gefahr, bei Übelkeit,Erbrechen,Kopfschmerzen übernehme ich keine Haftung. 8o

  • @Bert
    ich war so langsam am Tippen und da war Dein Beitrag meine ich noch nicht da,
    und in seinem Script wurden die Funktionen ja noch nicht mal aufgerufen,
    sofern ich mich da nicht verguckt habe :)

    Gruß Dietmar

    Achtung Anfänger! :whistling:

    Betrachten des Quellcodes auf eigene Gefahr, bei Übelkeit,Erbrechen,Kopfschmerzen übernehme ich keine Haftung. 8o

  • Ich würde die Checkboxen in einem Array machen, und dann hide und show und jeweils immer den Text ändern. Das alles in einer For-Schleife. Ist sinnvoller als die ganzen Zeilen Code.
    Und heißt das nicht _Liegestuetze()? ^^

    Achja darf/soll man denn alle Checkboxen auswählen können gleichzeitig? Wenn nein, dann nimm doch Radios.