dandymcgee Posted August 28, 2006 Posted August 28, 2006 I just finished making this very simple GUI trying to practice my GUI skills. For some reason I can't get it to stay open no matter what I do. It seems as if While 1 loops isn't working for me... Here is what I have written: #include <GUIConstants.au3> GUICreate("Main Window", 200, 200) $button = GUICtrlCreateButton("Pause", 110, 160, 60, 20) $button2 = GUICtrlCreateButton("Number Two", 105, 130, 70, 20) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $button MsgBox(0, "Testing...", "Button 1") Case $msg = $button2 MsgBox(0, "Testing...", "Button 2") Case $GUI_EVENT_CLOSE Exit EndSelect WEnd Now I'm sure there must be some really stupid mistake somewhere, but I don't see it. Sorry if this was a waste of your time, but I really can't figure this out. Thanks in advance. - Dan [Website]
Daniel W. Posted August 28, 2006 Posted August 28, 2006 You just wrote "Case $GUI_EVENT_CLOSE" Replace it with "Case $msg = $GUI_EVENT_CLOSE" --------------------------------------------------------------------------------------------------------------------------------Scripts : _Encrypt UDF_UniquePCCode UDF MS like calculatorInstall programm *UPDATED* --------------------------------------------------------------------------------------------------------------------------------[quote name='Helge' post='213117' date='Jul 26 2006, 10:22 AM']Have you ever tried surfing the internet with a milk-carton ?This is similar to what you're trying to do.[/quote]
dandymcgee Posted August 28, 2006 Author Posted August 28, 2006 LOL, Wow that sure is by far the dumbest mistake I've ever made lol. Thanks for taking the time to reply . - Dan [Website]
Somniis Posted August 28, 2006 Posted August 28, 2006 You could do it like you originally made it with a Switch statement. While 1 Local $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd
dandymcgee Posted August 28, 2006 Author Posted August 28, 2006 Hmmm... I've never really looked at a switch statement. That's pretty cool thanks Somniis. - Dan [Website]
Richard Robertson Posted August 28, 2006 Posted August 28, 2006 You think that's a bad mistake? You should see some of my crap. While Not Closing $count = $count += $count + 1 WEnd I seriously wrote that at one point.
dandymcgee Posted August 28, 2006 Author Posted August 28, 2006 (edited) @IceKirby1 - Lol, what exactly was that code meant to do? Looks like you were trying to break the record for most errors in fewest lines of code Edited August 28, 2006 by dandymcgee - Dan [Website]
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