Advertisement
name22

Modal GUI Example

Sep 8th, 2011
385
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 0.67 KB | None | 0 0
  1. #include <GUIConstants.au3>
  2.  
  3. Opt("GUIOnEventMode", 1)
  4.  
  5. $hWnd_1 = GUICreate("Test", 400, 400)
  6. $cButton = GUICtrlCreateButton("2nd GUI", 50, 50, 60, 25)
  7. GUISetState()
  8.  
  9. $hWnd_2 = GUICreate("Test 2", 300, 300, Default, Default, Default, Default, $hWnd_1)
  10.  
  11. GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit", $hWnd_1)
  12. GUISetOnEvent($GUI_EVENT_CLOSE, "_CloseGUI2", $hWnd_2)
  13. GUICtrlSetOnEvent($cButton, "_OpenGUI2")
  14.  
  15. While Sleep(1000)
  16. WEnd
  17.  
  18. Func _Exit()
  19.     Exit
  20. EndFunc
  21.  
  22. Func _OpenGUI2()
  23.     GUISetState(@SW_SHOW, $hWnd_2)
  24.     GUISetState(@SW_DISABLE, $hWnd_1)
  25. EndFunc
  26.  
  27. Func _CloseGUI2()
  28.     GUISetState(@SW_HIDE, $hWnd_2)
  29.     GUISetState(@SW_ENABLE, $hWnd_1)
  30.     WinActivate($hWnd_1)
  31. EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement