Jump to content
Sign in to follow this  

Cant get exit loop with button to work

Recommended Posts

I'm trying to figure out why you are not using a while loop instead. You say the loop could be anywhere between 1 and 5000 iterations. This loop will most likely time out before you get chance to interact with your GUI, so unless you are superman, nothing is likely to happen at that speed.

I also don't know what ' ; A bunch of code ' is doing in that first loop.

Edited by czardas

Share this post

Link to post
Share on other sites

 @MilesAhead, I guess I could go that route. I didn't know the For loop is the only one apparently that I cant interrupt with a gui button press. I guess I'll put an Or statement on the Until so it can exit upon the count being reached or the button being pressed. thanks.

Edited by Champak

Share this post

Link to post
Share on other sites

Why not use eventmode ?

#include <GUIConstantsEx.au3>
Opt("GuiOnEventMode", 1)
Global $stop = 0

GUICreate("My GUI") 
$label = GUICtrlCreateLabel("", 10, 30, 50, 20)
$btn = GUICtrlCreateButton("stop", 10, 50, 50, 20)
GUICtrlSetOnEvent(-1, "_stop")

For $i = 1 to 1000
  If $stop Then Exitloop
  GuiCtrlSetData($label, $i)
Msgbox(0,"", "stopped")

Func _stop()
  $stop = 1

Share this post

Link to post
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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...