Jump to content

GUI stopped in func section

Recommended Posts


Hello i have got a problem..

I have loop with the basic lines and plus one button.. If is button clicked, it start function and there's my problem.. When I have in my function Sleep command it freeze all buttons.. and GUI is useless then.. What's wrong? Which command can fix it? Is Sleep() correct with GUI?

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

$frm = GUICreate("Form1", 258, 65, 192, 132)
$startbtn = GUICtrlCreateButton("START", 16, 16, 75, 25)
$txt = GUICtrlCreateLabel("Program is waiting", 112, 20, 200, 20)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
        Case $startbtn
            $sbtn = GUICtrlRead($startbtn)
            If $sbtn = "START" Then
                GUICtrlSetData($startbtn, "STOP")
                GUICtrlSetData($txt, "Program in progress...")
                GUICtrlSetData($startbtn, "START")
                GUICtrlSetData($txt, "Program is waiting")

Func _Main()
EndFunc   ;==>_Main


Edited by Lyee

Share this post

Link to post
Share on other sites

There is nothing "wrong" as your gui message loop is interrupted by the call to the _Main() FUNC.
So it is really an design issue. :)

One thing to look for is to use the event mode for the GUI which allows for a alternative design.


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

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