Sign in to follow this  
Followers 0
dandymcgee

While Loop not working...

7 posts in this topic

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]

Share this post


Link to post
Share on other sites



You just wrote "Case $GUI_EVENT_CLOSE"

Replace it with "Case $msg = $GUI_EVENT_CLOSE" :P


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

Share this post


Link to post
Share on other sites

LOL, Wow that sure is by far the dumbest mistake I've ever made lol. Thanks for taking the time to reply :P.


- Dan [Website]

Share this post


Link to post
Share on other sites

Hmmm... I've never really looked at a switch statement. That's pretty cool thanks Somniis.


- Dan [Website]

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

#7 ·  Posted (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 :P

Edited by dandymcgee

- Dan [Website]

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  
Followers 0