Jump to content

Gui Stops Responding


Recommended Posts

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
Link to comment
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
Link to comment
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!

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...