BoonPek Posted June 17, 2010 Share Posted June 17, 2010 I am working on an almost complete project. I want to have a button that when clicked, opens a new GUI and when that GUI closes, the main GUI is still intact. Here is a part of my code: #include <GuiConstantsEX.au3> $MainGUI = GUICreate("Main GUI", 300, 200, -1, -1) $SetData = GUICtrlCreateButton("Set Data", 10, 10, 280, 180) GUISetState(@SW_SHOW) Do $msg = GUIGetMsg() Switch $msg Case $SetData SETDATA() EndSwitch Until $msg = $GUI_EVENT_CLOSE Func SETDATA() $Data = GUICreate("Set Data", 200, 300, -1, -1) GUISetState(@SW_SHOW) Do $msg1 = GUIGetMsg() Until $msg1 = $GUI_EVENT_CLOSE EndFunc I don't want the Main GUI to close when I close the Set Data GUI. Is there a way to allow this to happen without any modification of the Do-Until loop (The SetData Loop can be modified)? Link to comment Share on other sites More sharing options...
kaotkbliss Posted June 17, 2010 Share Posted June 17, 2010 (edited) *edit* Nevermind my previous idea it would not work this seems to be be working though. #include <GuiConstantsEX.au3> $MainGUI = GUICreate("Main GUI", 300, 200, -1, -1) $SetData = GUICtrlCreateButton("Set Data", 10, 10, 280, 180) GUISetState(@SW_SHOW) Do $msg = GUIGetMsg() Switch $msg Case $SetData SETDATA() EndSwitch Until $msg = $GUI_EVENT_CLOSE Func SETDATA() $Data = GUICreate("Set Data", 200, 300, -1, -1) GUISetState(@SW_SHOW) Do $msg1 = GUIGetMsg() Until $msg1 = $GUI_EVENT_CLOSE CLOSEClicked() EndFunc Func CLOSEClicked() GUIDelete() EndFunc I think it is the Do...Until that conflicts with the guigetmsg You could probably even remove the extra func and just add guidelete right after Until $msg1 = $GUI_EVENT_CLOSE *edit* yep, this works too #include <GuiConstantsEX.au3> $MainGUI = GUICreate("Main GUI", 300, 200, -1, -1) $SetData = GUICtrlCreateButton("Set Data", 10, 10, 280, 180) GUISetState(@SW_SHOW) Do $msg = GUIGetMsg() Switch $msg Case $SetData SETDATA() EndSwitch Until $msg = $GUI_EVENT_CLOSE Func SETDATA() $Data = GUICreate("Set Data", 200, 300, -1, -1) GUISetState(@SW_SHOW) Do $msg1 = GUIGetMsg() Until $msg1 = $GUI_EVENT_CLOSE GUIDelete() EndFunc Edited June 17, 2010 by kaotkbliss 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy! 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