eHrgo Posted April 12, 2007 Share Posted April 12, 2007 (edited) Hi guys, this time I want to make an easy example: #include <GUIConstants.au3> Opt("GuiOnEventMode",1) $Main=GUICreate ( 'Main Window', 90, 135, -1, -1, $WS_MINIMIZEBOX ) $close=GUICtrlCreateButton ( 'Close', 3, 90, 113, 18 ) $history=GUICtrlCreateButton ( 'History', 3, 73, 113, 18) GUICtrlSetOnEvent($Close, 'quit') GUICtrlSetOnEvent($history, 'History') While 1 GuiSetState(@SW_SHOW) Wend ;~ ;;FUNCTIONS----------------------------------------------------------- Func quit() Exit 0 EndFunc Func History() $Histo=GUICreate ( 'Secondary Window', 300, 150, -1, -1,$WS_MINIMIZEBOX, $WS_EX_TOPMOST ) $CloseHis=GUICtrlCreateButton ( 'Cancel', 5, 105, 285, 18 ) GUICtrlSetOnEvent($CloseHis, 'quit') While 1 GUISetState ( @SW_SHOW, $Histo) Sleep(50) Wend And an Easy question: Why the "GUICtrlSetOnEvent($CloseHis, 'quit')" in the Second UI isn't working? Thanks a lot Edited April 12, 2007 by eHrgo Sorry for my Bad English. Link to comment Share on other sites More sharing options...
evilertoaster Posted April 12, 2007 Share Posted April 12, 2007 Can't break 'inturupts' within 'inturupts' with gui events...http://www.autoitscript.com/forum/index.php?showtopic=28292 http://www.autoitscript.com/forum/index.php?showtopic=42375One of the more annoying factors of the feature IMO...you'll want-#include <GUIConstants.au3> Opt("GuiOnEventMode",1) $Main=GUICreate ( 'Main Window', 90, 135, -1, -1, $WS_MINIMIZEBOX ) $close=GUICtrlCreateButton ( 'Close', 3, 90, 113, 18 ) $history=GUICtrlCreateButton ( 'History', 3, 73, 113, 18) GUICtrlSetOnEvent($Close, 'quit') GUICtrlSetOnEvent($history, 'History') GuiSetState(@SW_SHOW) While 1 Sleep(1000) Wend ;~ ;;FUNCTIONS----------------------------------------------------------- Func quit() Exit 0 EndFunc Func History() $Histo=GUICreate ( 'Secondary Window', 300, 150, -1, -1,$WS_MINIMIZEBOX, $WS_EX_TOPMOST ) $CloseHis=GUICtrlCreateButton ( 'Cancel', 5, 105, 285, 18 ) GUICtrlSetOnEvent($CloseHis, 'quit') GUISetState ( @SW_SHOW, $Histo) EndFunc Link to comment Share on other sites More sharing options...
Zedna Posted April 12, 2007 Share Posted April 12, 2007 Not tested idea: try to use other function for example quit2() and not one quit() function for both windows. Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Zedna Posted April 12, 2007 Share Posted April 12, 2007 Try this: #include <GUIConstants.au3> Opt("GuiOnEventMode",1) $Main=GUICreate ( 'Main Window', 90, 135, -1, -1, $WS_MINIMIZEBOX ) $close=GUICtrlCreateButton ( 'Close', 3, 90, 113, 18 ) $history=GUICtrlCreateButton ( 'History', 3, 73, 113, 18) GUICtrlSetOnEvent($Close, 'quit') GUICtrlSetOnEvent($history, 'History') GuiSetState(@SW_SHOW) While 1 Sleep(1000) Wend ;~ ;;FUNCTIONS----------------------------------------------------------- Func quit() Exit 0 EndFunc Func History() Global $Histo=GUICreate ( 'Secondary Window', 300, 150, -1, -1,$WS_MINIMIZEBOX, $WS_EX_TOPMOST ) $CloseHis=GUICtrlCreateButton ( 'Cancel', 5, 105, 285, 18 ) GUICtrlSetOnEvent($CloseHis, 'quit2') GUISetState ( @SW_SHOW, $Histo) EndFunc Func quit2() GUIDelete($Histo) EndFunc Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
eHrgo Posted April 12, 2007 Author Share Posted April 12, 2007 Yep, thanks a lot, its almost the same Exemple... i'm stupid, I musn't do any loop. Working great, thanks a lot. Sorry for my Bad English. Link to comment Share on other sites More sharing options...
xcal Posted April 12, 2007 Share Posted April 12, 2007 Just to confuse things you can have one function handle gui_event_close for both gui... Func quit() Switch @GUI_WinHandle Case $main Exit Case $sub GUIDelete($sub) EndSwitch EndFunc How To Ask Questions The Smart Way Link to comment Share on other sites More sharing options...
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