Jump to content
Sign in to follow this  

(Solved)Need help on making basic GUI

Recommended Posts


I was trying to make some basic GUI... Only with two buttons but it just wont work. I know that its very simple but I cant find what is wrong.

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$mainwindow = GUICreate("home", 197, 49, 192, 124)
$Start = GUICtrlCreateButton("Start", 16, 8, 75, 25)
GUICtrlSetOnEvent($Start, "Start")
$Pause = GUICtrlCreateButton("Pause", 104, 8, 75, 25)
GUICtrlSetOnEvent($Pause, "Pause")

While 1
  Sleep(1000)  ; Idle around
Func Start()
Func Pause()
  MouseClick("right",100,100)  ;this is only for example, to see if button works
Edited by Edgaras

Share this post

Link to post
Share on other sites

You are trying to use OnEvent mode but AutoIt runs MessageLoop mode by default, see "GUI Concepts" in helpfile.

The default mode is the MessageLoop mode. To switch to OnEvent mode use Opt("GUIOnEventMode", 1).

Set GUIOnEventMode to 1 at the beginning of your script.

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