Ladebalken

  • Hallo Forum,

    ist es möglich (und wenn ja, wie?) mit GUICTRLCREATEPROGRESS einen Prozess zu erstellen, der langsam lädt, also zum Beispiel,
    dass er nach 10 sekunden erst den Wert 100 hat (bei 9 sekunden 90, 8=80, etc.)
    ohne das man es so umständlich schreiben muss:

    guictrlsetdata($prog1, 10)
    sleep(1000)
    guictrlsetdata($prog, 20)
    usw.
    weil das dauert ewig und sou


    Vielen Dank im Voraus
    aflakes

    Einmal editiert, zuletzt von aflakes (6. Februar 2011 um 16:37)

  • Meinst du so?

    [autoit]


    for $i = 0 to 100
    guictrlsetdata($prog1, $i)
    $i= $i +10
    sleep(1000)
    next

    [/autoit]

    Bin mir nicht sicher, ob ich dich richtig verstanden habe.

    Gruß Daniel

  • müsste es nicht so sein?

    [autoit]


    for $i = 1 to 10
    guictrlsetdata($prog1, $i*10)
    sleep(1000)
    next

    [/autoit]

    "Je mehr Käse, desto mehr Löcher; je mehr Löcher, desto weniger Käse. Ergo: Je mehr Käse, desto weniger Käse. 8| "
    "Programmers never die: they just GOSUB without RETURN"
    "I tried to change the world but I couldn't find the source code."

  • Optimieren wir mal deinen Code:

    [autoit]


    For $i = 0 To 100 Step 10
    GUICtrlSetData($prog, $i)
    Sleep(1000)
    Next

    [/autoit]
  • Hallo aflakes,

    ja mit AdlibRegister (diese Funktion solte dir ja von hier bekannt sein) Dies kann dann z.B.: so aussehen:

    Spoiler anzeigen
    [autoit]

    #include <ButtonConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <ProgressConstants.au3>
    #include <WindowsConstants.au3>
    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Form1", 625, 445, 192, 124)
    $Progress1 = GUICtrlCreateProgress(32, 336, 473, 97)
    $Button1 = GUICtrlCreateButton("+", 240, 120, 281, 41, $WS_GROUP)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

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

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Button1
    set()
    AdlibRegister("set",100)
    EndSwitch
    WEnd

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

    Func set()
    GUICtrlSetData($Progress1, GUICtrlRead($Progress1) + 1)
    EndFunc ;==>set

    [/autoit]

    mfg autoBert