Slvrngrn Posted September 28, 2009 Share Posted September 28, 2009 OK, super-n00b here...The code I have below is supposed to monitor my GUI. Obviously shut down the program if the GUI is exited, but I also want it to verify that a combobox selection has been made prior to moving on from the GUI. When I run it though I repeatedly get the MsgBox telling you to pick a crop. As soon as you close one box another pops up instantly. I tried $Button = 0 and $Button = False in the hopes that that would reset the button to the "unpressed" state. Is there a way to accomplish this so that once the MsgBox is closed the GUI will be "refreshed"? Or am I going about this completely wrong?Thanks for your help and patience...While $a = 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 $CropF = GUICtrlRead($Crop) If $CropF = "Select a crop..." Then MsgBox(0, "Pick a crop", "You must select a crop to harvest.") $a = 1 $Button1 = False Else $a = $a - 1 EndIf EndSwitch WEnd Link to comment Share on other sites More sharing options...
Inverted Posted September 28, 2009 Share Posted September 28, 2009 First of all, does this work better ? (as a first step) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 $CropF = GUICtrlRead($Crop) If $CropF = "Select a crop..." Then MsgBox(0, "Pick a crop", "You must select a crop to harvest.") EndIf EndSwitch WEnd Link to comment Share on other sites More sharing options...
Slvrngrn Posted September 28, 2009 Author Share Posted September 28, 2009 Yes, much cleaner. My trial and error has made a bit of mess... Link to comment Share on other sites More sharing options...
Inverted Posted September 28, 2009 Share Posted September 28, 2009 (edited) Now you can put your code inside a Else, after the If/Then. Right ? If oyu want to get rid of the GUI, take a look at GUIDelete, although I've never used it Edited September 28, 2009 by Inverted Link to comment Share on other sites More sharing options...
Slvrngrn Posted September 28, 2009 Author Share Posted September 28, 2009 I actually took a much different approach from what I was doing... all because of GUIDelete. That worked like a champ! Thanks a million!!! 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