Probleme mit Combobox

  • Hallo,

    ich bin noch ein ziemlicher AutoIt n00b und versuche grade ein Programm (GUI) zu erstellen bei dem man mit Hilfe einer Combobox über die länge eines Prozesses entscheiden kann. Sprich ich gebe einen Wert in die Combobox ein und die Progressbar brauch so lange bis zu ihrem Ziel wie der eingetippte wert. Leider kann ich im Programm selbst keinen wert eintippen sonder muss dies über den Quelltext mit "GUIctrlsetdata()" machen! Wenn ich dann einen Wert im Programm eingebe ändert sich einfach nichts und die Progressbar braucht immer so lange wie der im Quelltext eingegebene Wert! Wenn ich keinen Wert eingebe gibts nen Error!
    Bitte helft mir

    GreeZ Burnie

    Hier ist mein Code:

    [autoit]

    #include <GUIConstants.au3>
    #include <GuiCombo.au3>

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

    GUICreate("My GUI Progressbar",500,200, 100,200)
    $progressbar1 = GUICtrlCreateProgress (10,10,200,20)
    GUICtrlSetColor(-1,32250)
    $button = GUICtrlCreateButton ("Start",75,70,70,20)
    GuiCtrlCreateCombo("20", 350, 10, 80, 10,$CBS_DROPDOWNLIST)
    $option = GUICtrlSetData(-1,"50|150","150") --> den wert kann ich
    nur im quelltext ändern
    GUISetState()

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

    $_combo_text = GUICTRLRead($option)
    if $_combo_text = "20" then
    $wait = 20
    $s = 0
    EndIf
    if $_combo_text = "50" then
    $wait = 50
    $s = 0
    EndIf
    if $_combo_text = "150" then
    $wait = 100
    $s = 0
    endIf

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

    do
    $msg = GUIGetMsg()
    If $msg = $button Then
    GUICtrlSetData ($button,"Stop")
    For $i = $s To 100
    $m = GUIGetMsg ()

    If $m = -3 Then ExitLoop

    If $m = $button Then
    GUICtrlSetData ($button,"Next")
    $s = $i
    ExitLoop
    Else
    $s=0
    GUICtrlSetData ($progressbar1,$i)
    Sleep($wait)
    EndIf
    Next
    if $i >100 then

    GUICtrlSetData ($button,"Start")
    endif
    EndIf
    until $msg = $GUI_EVENT_CLOSE

    [/autoit]

    P.S.: Aso ja nen großen Teil hab ich halt ausm tut kopiert

    Einmal editiert, zuletzt von Burnie (17. Mai 2008 um 13:46)

  • Meinst du so was? Mit der ComboBox wird der Wert für die Pause festgelegt. Das jedes Mal, wenn auf Start bzw. Next geklickt wird.

    Spoiler anzeigen
    [autoit]

    #include <GUIConstants.au3>
    #include <GuiComboBox.au3>

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

    GUICreate("My GUI Progressbar",500,200, 100,200)
    $progressbar1 = GUICtrlCreateProgress (10,10,200,20)
    GUICtrlSetColor(-1,32250)
    $button = GUICtrlCreateButton ("Start",75,70,70,20)
    $option = GuiCtrlCreateCombo("20", 350, 10, 80, 10,$CBS_DROPDOWNLIST)
    GUICtrlSetData(-1,"50|150","150") ;den wert kann ich nur im quelltext ändern
    GUISetState()
    $s = 0
    do
    $msg = GUIGetMsg()
    If $msg = $button Then
    $wait = GUICtrlRead($option)
    GUICtrlSetData ($button,"Stop")

    For $i = $s To 100
    $m = GUIGetMsg ()

    If $m = -3 Then ExitLoop

    If $m = $button Then
    GUICtrlSetData ($button,"Next")
    $s = $i
    ExitLoop
    Else
    $s=0
    GUICtrlSetData ($progressbar1,$i)
    Sleep($wait)
    EndIf
    Next
    if $i >=100 then
    GUICtrlSetData ($button,"Start")
    endif
    EndIf
    until $msg = $GUI_EVENT_CLOSE

    [/autoit]
  • Jap genau das meine ich!
    Funktioniert alles Super
    Danke für die schnelle Antwort! :thumbup: