Jump to content

Adding Increasing/Decreasing A Progress's Bar


toothyXdip
 Share

Recommended Posts

I have ALMOST exactly the same problem as hellogoodbye (in Gender Help And Support)

The progress bar window would be frozen at around 20% and when i press the button (the button is on a different window) ALL the progress bars will go to 100% and it doesnt do it again. And it does the same thing for the script above(its a part of a script it doesnt show the button window func). What i want is just to have it where i press 1 button (on different window) and 1 progress bar will be read and it will +20 to w/e the % or where ever the progress bar is.

accept for me im not reading the place on the progress bar and im also making progress bars go up and down

heres my script (its hard to explain the problem so use it to see the probelm in detail):

#include <GuiConstants.au3>

Global $add_button
Global $i

GuiCreate("MyGUI", 392, 316,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$Button_1 = GuiCtrlCreateButton("Next", 110, 80, 170, 20)
GuiCtrlCreateLabel("Problem is in next window's", 50, 10, 270, 40)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Button_1
        game_button()
        progress()
    EndSelect
WEnd
Exit

Func game_button()
    GUIDelete()
    ;window-----------------
    GUICreate("Problem", 594, 310 , 200, 200, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
    GUISetBkColor(0x000000)
    GUICtrlSetState(-1, $GUI_DISABLE)
    ;buttons----------------
    $add_button = GUICtrlCreateButton("add", 250, 110, 70, 20)
    ;lable------------------
    GUISetFont(13, 900)
    $_lable = GUICtrlCreateLabel("I dont know what to do", 10, 20)
    ;colorsets--------------
    GUICtrlSetBkColor($_lable, $GUI_BKCOLOR_TRANSPARENT)
    GUICtrlSetColor($_lable, 0xFFFFFF)
    
    GUISetState(@SW_SHOW)
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            OnButtonExit()
    EndSelect
    ExitLoop
WEnd
EndFunc

Func OnButtonExit()
    While 1
    $anwser = MsgBox(36, "Quit?", "Do you want to quit?")
    If $anwser = 6 Then
        Exit
    ElseIf $anwser = 7 Then
        ExitLoop
    EndIf
WEnd
EndFunc

Func OnButtonExitDoesntWork()
    While 1
    $anwser = MsgBox(46, "Quit?", "Do you want to quit?")
WEnd
EndFunc

Func progress()
    $progres_window = GUICreate("Progress Bar",220,200, 100,200)
    $Progress1 = GUICtrlCreateProgress(10, 20, 100, 20)
    GUICtrlSetData($Progress1, 25)
    $Progress2 = GUICtrlCreateProgress(10, 50, 100, 20)
    GUICtrlSetData($Progress2, 25)
    $Progress3 = GUICtrlCreateProgress(10, 80, 100, 20)
    GUICtrlSetData($Progress3, 25)
    $Progress4 = GUICtrlCreateProgress(10, 110, 100, 20)
    GUICtrlSetData($Progress4, 25)
    GUISetState (@SW_SHOW)
    
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            OnButtonExitDoesntWork()
        Case $msg = $add_button
            $add = $i + 20
For $i = 100 To 0 Step -5
    GUICtrlSetData($Progress1,$i)
    Sleep(1000)
For $i = 0 To 100 Step +5
    GUICtrlSetData($Progress2,$i)
    Sleep(1000)
For $i = 0 To 100 Step +5
    GUICtrlSetData($Progress3,$i)
    Sleep(1000)
For $i = 100 To 0 Step -5
    GUICtrlSetData($Progress4,$i)
    Sleep(1000)
Next
Exit
Next
Exit
Next
Exit
Next
Exit
ExitLoop
EndSelect
WEnd
EndFunc
Edited by toothyXdip
---╔╦═╗╔╗'''╔╗╔═╦═╗╔╦═╗---╝╠═╣╝║'''║╝╝''''''╝╝║'''......''''''''''''''''''''''''''''''---╔╩═╩═╩═╩═══╩═╦═╩═╩══╦══════╗''''╔╩════════════╩══╗╔══╩══╗╔══╝ ''''''''''''''''''''''''''''''''''''''''''''''''''''║║'''''''''''''''║║ ''''''''''''''''''''''''''''''''''''''''''''''╔══╝╚══╗''''''║║''''''''''''''''''''''''''''''''''''''''''''''╚══════╝''''''╚╝
Link to comment
Share on other sites

I re-wrote most of it, what is up with your fondness with "Exit"s and "exitloop"s?

#include <GuiConstants.au3>

Global $add_button
Global $i

GuiCreate("MyGUI", 392, 316,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$Button_1 = GuiCtrlCreateButton("Next", 110, 80, 170, 20)
GuiCtrlCreateLabel("Problem is in next window's", 50, 10, 270, 40)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Button_1
        progress()
    EndSelect
WEnd
Exit



Func progress()
    GUIDelete()
    ;window-----------------
    GUICreate("Problem", 594, 310 , 200, 200, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
    GUISetBkColor(0x000000)
    GUICtrlSetState(-1, $GUI_DISABLE)
    ;buttons----------------
    $add_button = GUICtrlCreateButton("add", 250, 110, 70, 20)
    ;lable------------------
    GUISetFont(13, 900)
    $_lable = GUICtrlCreateLabel("I dont know what to do", 10, 20)
    ;colorsets--------------
    GUICtrlSetBkColor($_lable, $GUI_BKCOLOR_TRANSPARENT)
    GUICtrlSetColor($_lable, 0xFFFFFF)
   
    GUISetState(@SW_SHOW)
    $progres_window = GUICreate("Progress Bar",220,200, 100,200)
    $Progress1 = GUICtrlCreateProgress(10, 20, 100, 20)
    GUICtrlSetData($Progress1, 25)
    $Progress2 = GUICtrlCreateProgress(10, 50, 100, 20)
    GUICtrlSetData($Progress2, 25)
    $Progress3 = GUICtrlCreateProgress(10, 80, 100, 20)
    GUICtrlSetData($Progress3, 25)
    $Progress4 = GUICtrlCreateProgress(10, 110, 100, 20)
    GUICtrlSetData($Progress4, 25)
    GUISetState (@SW_SHOW)
   
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            OnButtonExit()
        Case $msg = $add_button
            $add = $i + 20
            $a=100
            $b=0
            $c=0
            $d=100
            Do
                $a -=5  
                $b +=5
                $c +=5
                $d -=5      
                GUICtrlSetData($Progress1,$a)
                Sleep(100)
                GUICtrlSetData($Progress2,$B)
                Sleep(100)
                GUICtrlSetData($Progress3,$c)
                Sleep(100)
                GUICtrlSetData($Progress4,$d)
                Sleep(100)
            Until $a = 0 and $b= 100 and $c=100 and $d = 0
    EndSelect
WEnd
EndFunc

Func OnButtonExit()
    $anwser = MsgBox(36, "Quit?", "Do you want to quit?")
    If $anwser = 6 Then
        Exit
    EndIf
EndFunc
Link to comment
Share on other sites

:):whistle::lol::):(B):lol::P:*

oops lol...."GENERAL" help and support

but i almost have the same problem now it still starts around 20-40% but it doesnt add 20% to the bar i just loops them with adding and subtracing...i want it to add and subtract from when ithe next button is clicked and be able to add 20% and anytime (if teh progress bar looks like this (=== ) you press teh add button and it then looks like this

(===== )

i tryed changing the $add = $i + 20 to $add= $a + 20, $add= $b + 20, $add= $c + 20, $add= $d + 20 and they just closed the program when i pressed teh add button

Thanks,

Toothy

Edited by toothyXdip
---╔╦═╗╔╗'''╔╗╔═╦═╗╔╦═╗---╝╠═╣╝║'''║╝╝''''''╝╝║'''......''''''''''''''''''''''''''''''---╔╩═╩═╩═╩═══╩═╦═╩═╩══╦══════╗''''╔╩════════════╩══╗╔══╩══╗╔══╝ ''''''''''''''''''''''''''''''''''''''''''''''''''''║║'''''''''''''''║║ ''''''''''''''''''''''''''''''''''''''''''''''╔══╝╚══╗''''''║║''''''''''''''''''''''''''''''''''''''''''''''╚══════╝''''''╚╝
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...