Champak Posted December 15, 2013 Share Posted December 15, 2013 For $I = 0 to 10;Could be anywhere from 1 to 5000 ;A bunch of code $msg = GUIGetMsg() Select Case $msg = $LOAD_SCREEN ExitLoop EndSelect next for $I = 5 to 10 $msg = GUIGetMsg() if $msg = $LOAD_SCREEN Then ExitLoop next These are what I've tried, Thanks Link to comment Share on other sites More sharing options...
czardas Posted December 15, 2013 Share Posted December 15, 2013 (edited) 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 December 16, 2013 by czardas operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
MilesAhead Posted December 16, 2013 Share Posted December 16, 2013 (edited) Right. Or even a Do loop. Do $msg = GUIGetMsg() Select Case $msg = $LOAD_SCREEN SomeFunc() EndSelect Until $msg = $GUI_EVENT_CLOSE Edited December 16, 2013 by MilesAhead My Freeware Page Link to comment Share on other sites More sharing options...
Champak Posted December 16, 2013 Author Share Posted December 16, 2013 (edited) @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 December 16, 2013 by Champak Link to comment Share on other sites More sharing options...
markyrocks Posted December 16, 2013 Share Posted December 16, 2013 You can't interrupt it because it's over and out of the loop in a blink of an eye Spoiler "I Believe array math to be potentially fatal, I may be dying from array math poisoning" Link to comment Share on other sites More sharing options...
mikell Posted December 16, 2013 Share Posted December 16, 2013 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") GUISetState() For $i = 1 to 1000 If $stop Then Exitloop GuiCtrlSetData($label, $i) Sleep(300) Next Msgbox(0,"", "stopped") Func _stop() $stop = 1 EndFunc Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now