Jump to content

How to stop a function with a GUI button


phatzilla
 Share

Recommended Posts

So heres the story, i have a gui button "start", when i press it will start a rather long winded function that runs on a loop (If i were to wait for it to finish, would take ~5 minutes or so). However, i want a "stop" button wherein if i push it, it will stop the function at any time.

Here's the relevant code

While 1
        $msg = GUIGetMsg()
        Select
            Case $msg = $GUI_EVENT_CLOSE
                ExitLoop
;############################################## Clicked on Play Increase Button #####################################################################
            Case $msg = $Go
    guisetfont(9,4000,0)
    GUICtrlCreateLabel(guictrlread($increase), 260, 130, 300, 50)
    GUICtrlCreateLabel("# increased : ", 157, 170, 300, 15)
    $increaser = guictrlcreatelabel("0",260,170,100,15)
    increaser() ; run our increaser function
 
;############################################## Clicked on Stop Play increaser #####################################################################
   case $msg = $stop
  
Dont iknow what to put here!
 
        EndSelect
    WEnd

So after i click start, the "increaser()" function begins, however i want to be able to stop that function even if its half way through, but it seems as if it only waits for the function to finish before any buttons become "active" on the gui...

any help

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...