Developers Jos Posted November 18, 2012 Developers Posted November 18, 2012 (edited) By the way... Just a couple of minutes to show option 1 of the same example: expandcollapse popup#include <GUIConstantsEx.au3> Global $option Opt("GUIOnEventMode", 1) Example() Func Example() Local $Button_1, $Button_2, $msg GUICreate("My GUI Button") ; will create a dialog box that when displayed is centered GUISetOnEvent($GUI_EVENT_CLOSE, "SpecialEvents") GUISetOnEvent($GUI_EVENT_MINIMIZE, "SpecialEvents") GUISetOnEvent($GUI_EVENT_RESTORE, "SpecialEvents") Opt("GUICoordMode", 2) $Button_1 = GUICtrlCreateButton("Wait for window", 10, 30, 100) GUICtrlSetOnEvent(-1, "WinWaitPressed") $Button_2 = GUICtrlCreateButton("Close", 0, -1) GUICtrlSetOnEvent(-1, "ClosePressed") GUISetState() ; will display an dialog box with 2 button ; Run the GUI until the dialog is closed While 1 Switch $option Case 0 Case 1 $option = 0 GUICtrlSetData($Button_1, "Waiting-hang") WinWait("does exixts") ; hanging func GUICtrlSetData($Button_1, "Wait for window") EndSwitch Sleep(10) WEnd EndFunc ;==>Example ; Func ClosePressed() MsgBox(0, "Event - Close Pressed", "ID=" & @GUI_CtrlId & " WinHandle=" & @GUI_WinHandle & " CtrlHandle=" & @GUI_CtrlHandle) Exit EndFunc ;==>ClosePressed ; Func WinWaitPressed() $option = 1 EndFunc ;==>ClosePressed ; Func SpecialEvents() Select Case @GUI_CtrlId = $GUI_EVENT_CLOSE MsgBox(0, "Event-Close Pressed", "ID=" & @GUI_CtrlId & " WinHandle=" & @GUI_WinHandle) Exit EndSelect EndFunc ;==>SpecialEvents Edited November 18, 2012 by Jos 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.
telmob Posted November 18, 2012 Author Posted November 18, 2012 Very nice. I also tried to have a function specific for winwaitclose in the previous example, but it hanged the same.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now