satanttin Posted March 5, 2013 Share Posted March 5, 2013 Hello dear scripters, I was learning how to work with multiple gui's but the problem is when i open a gui and close it my previous gui doesn't work anymore i can't even close it? here is the code: expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3>#Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 615, 438, 192, 124) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### WinSetState ( $form1, "text", @SW_HIDE ) HotKeySet("!a", "show") HotKeySet("!s", "hide") HotKeySet("{F1}", "help") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE exit Func show() WinSetState ($Form1, "test", @sw_show) EndFunc Func hide() WinSetState ($Form1, "test", @sw_hide) EndFunc Func help() $Form2 = GUICreate("Form2", 409, 438, 192, 124) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE WinSetState ($Form2, "test", @sw_hide) WinSetState ($Form1, "test", @SW_SHOW) EndSwitch WEnd EndFunc EndSwitch WEnd hope someone can help me^^ Greetz. Link to comment Share on other sites More sharing options...
water Posted March 5, 2013 Share Posted March 5, 2013 Did you check the wiki tutorial for multiple GUIs? This should answer your questions My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
satanttin Posted March 5, 2013 Author Share Posted March 5, 2013 oh no i didn't will check it right now:) Link to comment Share on other sites More sharing options...
satanttin Posted March 5, 2013 Author Share Posted March 5, 2013 still have a problem with useing functions in the gui1 function:( Link to comment Share on other sites More sharing options...
water Posted March 5, 2013 Share Posted March 5, 2013 This should work:expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 615, 438, 192, 124) GUISetState(@SW_SHOW) #endregion ### END Koda GUI section ### WinSetState($Form1, "text", @SW_HIDE) HotKeySet("!a", "show") HotKeySet("!s", "hide") HotKeySet("{F1}", "help") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func show() WinSetState($Form1, "test", @SW_SHOW) EndFunc ;==>show Func hide() WinSetState($Form1, "test", @SW_HIDE) EndFunc ;==>hide Func help() Local $nMsg $Form2 = GUICreate("Form2", 409, 438, 192, 124) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE GUIDelete($Form2) WinSetState($Form1, "test", @SW_SHOW) ExitLoop EndSwitch WEnd EndFunc ;==>help My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
satanttin Posted March 5, 2013 Author Share Posted March 5, 2013 Thanks for the reply just found few sec ago how it works:P still thanks ^^ here is the code i use now: expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3>Opt("GUIOnEventMode", 1) Global $Form2, $email, $Form3 $email = "satanttin@live.nl" HotKeySet ("{F1}", "help") HotKeySet ("{F2}", "credits") guimain() Func guimain() #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 615, 438, 192, 124) GUISetOnEvent(-1, "help") GUISetOnEvent(-1, "credits") GUISetOnEvent($GUI_EVENT_CLOSE, "Close") GUISetState() While 1 WEnd EndFunc Func guihelp() $Form2 = GUICreate("Form2", 409, 438, 192, 124) $Label1 = GUICtrlCreateLabel("Help.", 8, 8, 68, 36) GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif") $Label2 = GUICtrlCreateLabel("If you have questions about this application.", 8, 48, 211, 17) $Label3 = GUICtrlCreateLabel("Then please send an email to: "&$email, 150, 72, 250, 17) $Label4 = GUICtrlCreateLabel("F1 = Help", 8, 112, 50, 17) $Label5 = GUICtrlCreateLabel("F2 = Credits", 8, 136, 60, 17) GUISetOnEvent($GUI_EVENT_CLOSE, "HelpClose") GUISetState() While 1 WEnd EndFunc Func guicredits() $Form3 = GUICreate("Form3", 365, 153, 192, 124) $Label1 = GUICtrlCreateLabel("Credits:", 120, 0, 114, 41) GUICtrlSetFont(-1, 25, 400, 0, "MS Sans Serif") $Label2 = GUICtrlCreateLabel("Maker: Tijn Tinnenbroek", 112, 72, 120, 17) $Label3 = GUICtrlCreateLabel("Programs used: Autoit and Koda.", 112, 88, 159, 17) GUISetOnEvent($GUI_EVENT_CLOSE, "CreditsClose") GUISetState() EndFunc Func Close() Exit EndFunc Func HelpClose() GUIDelete ($Form2) EndFunc Func CreditsClose() GUIDelete ($Form3) EndFunc Func help() guihelp() EndFunc Func credits() guicredits() EndFunc Link to comment Share on other sites More sharing options...
water Posted March 5, 2013 Share Posted March 5, 2013 Now you have two solutions. One in MessageLoop Mode the other in OnEvent Mode My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
satanttin Posted March 5, 2013 Author Share Posted March 5, 2013 just think i like on event better cause it's easyer xD Link to comment Share on other sites More sharing options...
water Posted March 5, 2013 Share Posted March 5, 2013 You can do whatever you like as long as it gives you the desired result My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki 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