Advertisement
Sprenger120

GUI On Event Beispiel (2GUI's)

Apr 23rd, 2011
335
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 0.96 KB | None | 0 0
  1. #include <GUIConstantsEx.au3>
  2.  
  3. Opt("GUIOnEventMode", 1) ;On Event Modus anschalten.  GuiGetMsg Funktioniert jetzt nicht mehr !
  4.  
  5. GUICreate("GUI1", 245, 163, 0, 0)
  6. GUISetOnEvent($GUI_EVENT_CLOSE,"_Exit") ;Event Registrieren (Rotes Kreuz oben)
  7. GUICtrlCreateButton("Button1", 80, 40, 75, 25)
  8. GUICtrlSetOnEvent(-1,"_Button1") ;Event für Button 1    (Wenn man bei Control ID -1 angibt dann nimmt er die ID des zuletzt erstellten Controls)
  9. GUISetState(@SW_SHOW)
  10.  
  11.  
  12. GUICreate("GUI2", 245, 163, 250, 0)
  13. GUISetOnEvent($GUI_EVENT_CLOSE,"_Exit");Event Registrieren (Rotes Kreuz oben)
  14. GUICtrlCreateButton("Button2", 80, 40, 75, 25)
  15. GUICtrlSetOnEvent(-1,"_Button2") ;7
  16. GUISetState(@SW_SHOW)
  17.  
  18.  
  19.  
  20.  
  21. While Sleep(50) ;Damit autoit nicht einfach ausgeht
  22. WEnd
  23.  
  24.  
  25. Func _Button2()
  26.     MsgBox(0, "", "Button 2 wurde gedrückt")
  27. EndFunc   ;==>_Button2
  28.  
  29. Func _Button1()
  30.     MsgBox(0, "", "Button 1 wurde geklickt")
  31. EndFunc   ;==>_Button1
  32.  
  33.  
  34. Func _Exit()
  35.     Exit
  36. EndFunc   ;==>_Exit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement