Sign in to follow this  
Followers 0
beestinga

Gui Stops Responding

7 posts in this topic

#1 ·  Posted (edited)

Hokay,

So I've got a script that looks like this:

thing1()
func thing1()
 rock people's socks off for a while here.
thing2()
Endfunc
func thing2()
GuiCreate("Action!",260,100)
    GUISetState()
    Opt("GUICoordMode",2)
    Opt("GUIOnEventMode", 1)
    $hitbutton=GUICtrlCreateButton ("Action 1",  10, 30, 50)
    GUICtrlSetOnEvent(-1, "thing1")
    $standbutton=GUICtrlCreateButton ( "Action 3",  0, -1)
    GUICtrlSetOnEvent(-1, "thing3")
    While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    Wend
EndFunc
func thing3()
guidelete("Action!")
 Rock some more socks off, totally flipping out and killing kittens and stuff...
thing1()
endfunc

OK, so basically, i launch the app, it does some stuff, launches a gui for me to choose what to do, I choose and it does that stuff, then basically starts over again. Clearly, all of this would be much easier if I could figure out how to program in MessageLoop mode, as I think that's more attuned for what I'm trying to do than OnEvent mode.

Anyhow, my problem is that the script works perfectly the first time through. I click my button, it executes the button's function, goes back to the top, and re-creates my gui for me, but when I click on the buttons on the gui, nothing happens. The gui shows up just right, but none of the buttons work, for some reason.

Edited by beestinga

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Guigetmsg and Guieventmode are not friends :)

you didnt even include guiconstants

Edited by thatsgreat2345

Share this post


Link to post
Share on other sites

you didnt even include guiconstants

When I said that I didn't know how to use Loops, it was meant to convey that I don't claim to know what I'm doing.

Please enlighten me.

Share this post


Link to post
Share on other sites

replaced

While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    Wend

with

While 1
  Sleep(1000) ; Idle around
WEnd

same problem

Share this post


Link to post
Share on other sites

try this

#include <GUIConstants.au3>
    $GUI = GuiCreate("Action!",260,100)
    $hitbutton=GUICtrlCreateButton ("Action 1",  10, 30, 50)
    $standbutton=GUICtrlCreateButton ( "Action 3",  100, 5)
    GUISetState()
Do
    $msg = GUIGetMsg()
    Select
        Case $msg = $hitbutton
            MsgBox(0,"Hit Button","You Hit the Action 1 Button")
        Case $msg = $standbutton
            MsgBox(0,"Stand Button","You hit the Action 3 Button")
    EndSelect
Until $msg = $GUI_EVENT_CLOSE

Share this post


Link to post
Share on other sites

try this

#include <GUIConstants.au3>
    $GUI = GuiCreate("Action!",260,100)
    $hitbutton=GUICtrlCreateButton ("Action 1",  10, 30, 50)
    $standbutton=GUICtrlCreateButton ( "Action 3",  100, 5)
    GUISetState()
Do
    $msg = GUIGetMsg()
    Select
        Case $msg = $hitbutton
            MsgBox(0,"Hit Button","You Hit the Action 1 Button")
        Case $msg = $standbutton
            MsgBox(0,"Stand Button","You hit the Action 3 Button")
    EndSelect
Until $msg = $GUI_EVENT_CLOSE
Let me work with this a little bit and see what happens.

Thanks!

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

this fixed my problem.

On the agenda for next week:

getting less retarded at this

Thanks a ton for your help.

Edited by beestinga

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