Jump to content

GUI Loop problem..


lopolop
 Share

Recommended Posts

ok i cant figure out what to do.. so i have a normal GUI that works good, if i hit Ext, File>Exit, or A Exit button it works, then if i hit start it all goes well.. but when i hit start i disable all buttons except for one.. i enable, and then run a loop, my GUI becomes unresponisve.. so then i add like If $Msg = $GUI_Button Then Exit, still nothing happens, i dont under stand why it doesnt work..

Link to comment
Share on other sites

I think its line 60 that is causing the problem .. :D

60's fine, its like 142 thats the real problem. Could be the magic ball is acting up tho :)

Link to comment
Share on other sites

ok here is some code..

While 1
    $Msg = GUIGetMsg()
        ; ##"Exit"##
        If $Msg = $GUI_EVENT_CLOSE Then Exit
        If $Msg = $GUI_Func_Exit Then Exit
        If $Msg = $GUI_Menu_File_Exit Then Exit
        ; ##########
        If $Msg = $GUI_Func_Start Then
            Start()
        EndIf
        If $Msg = $GUI_Func_Stop Then Exit  
WEnd
;Ok so now i hit $GUI_Func_Start...
Func Start()
    Disable()
    GUICtrlSetData($GUI_Status, "Running")
    While 1
        Sleep(.05)
        If _IsPressed(10, $dll) Then
                $pos = MouseGetPos()
                $coord = PixelSearch(($pos[0] - 50) , ($pos[1] - 50) , ($pos[0] + 50) , ($pos[1] + 50), $AIMCOLOR, 15)
                If IsArray($coord) = 1 Then
                    MouseMove($coord[0], $coord[1], 0)
                EndIf
        EndIf
        If $Msg = $GUI_EVENT_CLOSE Then Exit
        If $Msg = $GUI_Func_Stop Then Exit  
    WEnd
EndFunc
Func Disable()
    GUICtrlSetState($GUI_Func_Start, $GUI_DISABLE)
    GUICtrlSetState($GUI_Func_Exit, $GUI_DISABLE)
    GUICtrlSetState($GUI_Func_Stop, $GUI_ENABLE)
EndFunc
;Now $GUI_Func_Stop wont work...
Link to comment
Share on other sites

  • Developers

you are not reading the message queue in the Start() function..

put a " $Msg = GUIGetMsg()" in the loop ..

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

ooo i see ok thanks.. i didnt realize that the $msg didnt work for that function..

Do you actually understand ? GUIGetMsg is in an entirely different loop and since it isn't called in the active loop

then you can't expect AutoIt to update $msg automagically for you.

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