Jump to content

Recommended Posts

  • Developers
Posted (edited)

By the way... Just a couple of minutes to show option 1 of the same example:

#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 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.
  :)

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...