langthang084 Posted December 23, 2015 Share Posted December 23, 2015 My main Gui has 2 button. Click Button1 to create GUI1, Click Button2 to create GUI 2How to switch between GUI1 and GUI2 by click Button on the main gui (ex: If im working on GUI1, Click Button2 then GUI2 is actived, and GUI1 is deleted)Here's my code, but It create too main GUI1 and GUI2#include <Constants.au3> #include <GUIConstantsEx.au3> #include <Misc.au3> #include <WindowsConstants.au3> #include <ButtonConstants.au3> Global $MainStyle = BitOR($WS_OVERLAPPED, $WS_CAPTION, $WS_SYSMENU, $WS_VISIBLE, $WS_CLIPSIBLINGS, $WS_MINIMIZEBOX) Global $hMain = GuiCreate("MyGUI", 177, 451, -1, -1, $MainStyle) Global $Button_1 = GuiCtrlCreateButton("Button1", 20, 20, 130, 40) Global $Button_2 = GuiCtrlCreateButton("Button2", 20, 90, 130, 40) GuiSetState(@SW_SHOWNORMAL) Do Switch GuiGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $Button_1 Global $Gui1 = GuiCreate("MyGUI1", 166, 111, -1, -1, $MainStyle) Global $Label_1 = GuiCtrlCreateLabel("GUI 1", 40, 20, 90, 30) case $Button_2 Global $Gui2 = GuiCreate("MyGUI2", 166, 111, -1, -1, $MainStyle) Global $Label_1 = GuiCtrlCreateLabel("GUI 2", 40, 20, 90, 30) ; EndSwitch Until False #EndRegion Link to comment Share on other sites More sharing options...
Developers Jos Posted December 23, 2015 Developers Share Posted December 23, 2015 (edited) I guess you should do a GuiDelete($Gui2) when creating $GUI1 and visa versa.Other option is to create both GUI's and hide them. Only show them when you need to.Jos Edited December 23, 2015 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
langthang084 Posted December 23, 2015 Author Share Posted December 23, 2015 Thanks Jos!I've resolve this. But how to attach GUI1 on main Gui (when working on GUI1). Because if I click on Main GUI (not the Button), then GUi1 will be hidden Link to comment Share on other sites More sharing options...
Developers Jos Posted December 23, 2015 Developers Share Posted December 23, 2015 Maybe a good place to start reading how to handle multiple GUI's is this WiKI page: https://www.autoitscript.com/wiki/Managing_Multiple_GUIsJos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. 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