Collins Posted May 26, 2018 Share Posted May 26, 2018 Hello all. How do i close a first gui and then call a function with a different gui.. Below is my code expandcollapse popup#include <GUIConstantsEx.au3> Example() Func Example() ; Create a GUI with various controls. Local $hGUI = GUICreate("Example") Local $idOK = GUICtrlCreateButton("OK", 310, 370, 85, 25) ; Display the GUI. GUISetState(@SW_SHOW, $hGUI) ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $idOK Call("secondGui") ExitLoop EndSwitch WEnd ; Delete the previous GUI and all controls. GUIDelete($hGUI) EndFunc ;==>Example Func secondGui() ; Create a GUI with various controls. Local $sGUI = GUICreate("SECONDGUI") Local $exit = GUICtrlCreateButton("EXIT", 310, 370, 85, 25) ; Display the GUI. GUISetState(@SW_SHOW, $sGUI) ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $exit ExitLoop EndSwitch WEnd ; Delete the previous GUI and all controls. GUIDelete($sGUI) EndFunc Link to comment Share on other sites More sharing options...
mikell Posted May 26, 2018 Share Posted May 26, 2018 You call secondGui() before the Exitloop, so you go into the 2nd While loop before exiting the 1st one... and the GuiDelete() currently works after exiting the While loop Link to comment Share on other sites More sharing options...
Collins Posted May 27, 2018 Author Share Posted May 27, 2018 can you give me sample please Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted May 27, 2018 Moderators Share Posted May 27, 2018 @Collins why do you need an example, the explanation was very clear: #include <GUIConstantsEx.au3> Example() Func Example() ; Create a GUI with various controls. Local $hGUI = GUICreate("Example") Local $idOK = GUICtrlCreateButton("OK", 310, 370, 85, 25) ; Display the GUI. GUISetState(@SW_SHOW, $hGUI) ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $idOK Call("secondGui") ExitLoop <=====You exit your Loop HERE, BEFORE calling GUIDelete| | EndSwitch | WEnd | | ; Delete the previous GUI and all controls. | GUIDelete($hGUI)<===========================================================| Here EndFunc ;==>Example So if you want to close the first gui, where do you suppose you need to move the GuiDelete call? "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
jchd Posted May 27, 2018 Share Posted May 27, 2018 That, and you don't need to use Call(), just invoke your function. This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
Collins Posted May 27, 2018 Author Share Posted May 27, 2018 Thank you guys Link to comment Share on other sites More sharing options...
Collins Posted May 27, 2018 Author Share Posted May 27, 2018 2 hours ago, JLogan3o13 said: @Collins why do you need an example, the explanation was very clear: #include <GUIConstantsEx.au3> Example() Func Example() ; Create a GUI with various controls. Local $hGUI = GUICreate("Example") Local $idOK = GUICtrlCreateButton("OK", 310, 370, 85, 25) ; Display the GUI. GUISetState(@SW_SHOW, $hGUI) ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $idOK Call("secondGui") ExitLoop <=====You exit your Loop HERE, BEFORE calling GUIDelete| | EndSwitch | WEnd | | ; Delete the previous GUI and all controls. | GUIDelete($hGUI)<===========================================================| Here EndFunc ;==>Example So if you want to close the first gui, where do you suppose you need to move the GuiDelete call? i tried your code. and the first gui does not delete until the second gui is closed Link to comment Share on other sites More sharing options...
Collins Posted May 27, 2018 Author Share Posted May 27, 2018 expandcollapse popup#include <GUIConstantsEx.au3> Example() Func Example() ; Create a GUI with various controls. Local $hGUI = GUICreate("Example") Local $idOK = GUICtrlCreateButton("OK", 310, 370, 85, 25) ; Display the GUI. GUISetState(@SW_SHOW, $hGUI) ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $idOK Call("secondGui") ExitLoop EndSwitch WEnd ; Delete the previous GUI and all controls. GUIDelete($hGUI) EndFunc ;==>Example Func secondGui() ; Create a GUI with various controls. Local $sGUI = GUICreate("SECONDGUI") Local $exit = GUICtrlCreateButton("EXIT", 310, 370, 85, 25) ; Display the GUI. GUISetState(@SW_SHOW, $sGUI) ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $exit ExitLoop EndSwitch WEnd ; Delete the previous GUI and all controls. GUIDelete($sGUI) EndFunc Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted May 27, 2018 Moderators Share Posted May 27, 2018 3 hours ago, Collins said: i tried your code. and the first gui does not delete until the second gui is closed Then you are obviously not reading it correctly, as your code in the last post is still wrong. Not sure how I can spoon feed it to you any more clearly than I did before, or any more clearly than mikell did before me - Move the first GuiDelete up above the First ExitLoop "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
mikell Posted May 27, 2018 Share Posted May 27, 2018 @JLogan3o13 To write the text in italic/red is a pretty good idea. It could work Link to comment Share on other sites More sharing options...
jchd Posted May 27, 2018 Share Posted May 27, 2018 Try voodoo guys. This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
Collins Posted May 27, 2018 Author Share Posted May 27, 2018 Thank you guys.. I really appreciate your help.. It worked 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