Hi all,
What I am trying to do at the moment is I have a gui and in the gui is a button, when the button is pressed it should close the gui, I haven't been able to figure out why this isn't working but it does close the gui when the x is pushed or esc so that on event is working, am I missing something?
The following code is where the button and on event is done
AutoIt
; ===================================== ; ; The GUI Window Is Created Here ; ; Created By: Adam Blackburn ; ; ===================================== ; ; Includes #include <GUIConstantsEX.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <GUIButton.au3> #include "Conditionals.au3" ; Enable onEvent Mode Opt("GUIOnEventMode", 1) ; GUI Windows Dimensions Global $GUIWidth = 600 Global $GUIHeight = 400 Global $newButton Func mainGUI() ; Creates the main GUI window $mainGUI = GUICreate("", $GUIWidth, $GUIHeight, Default, Default, BitOR($WS_CAPTION, $WS_MINIMIZEBOX, $WS_SYSMENU)) ; Creates the "Left Pane" in the GUI Window $leftPane = GUICtrlCreateGroup("", 0, 10, 400, 400) newButton() ; Creates the "Right Pane" in the GUI Window $rightPane = GUICtrlCreateGroup("", 400, 10, 200, 400) ; onEvents() has all setOnEvents [ex: For when a button is pushed) onEvents() ; Show the GUI GUISetState(@SW_SHOW) ; This is so the GUI stays Open While 1 Sleep(1000) WEnd EndFunc ;==>mainGUI Func newButton() $newButton = GUICtrlCreateButton("New Button", 10, 10, 100, 100) EndFunc ; All the events to do when an action is performed (button push) Func onEvents() ; Exits when the button is pushed GUISetOnEvent($newButton, "OnExit") ; Close the GUI when an exit action is performed (Clicking the 'X' or 'Close' Button) GUISetOnEvent($GUI_EVENT_CLOSE, "OnExit") EndFunc ;==>onEvents
And this is where the "exit" event is.