Damein Posted November 27, 2010 Posted November 27, 2010 So I have this script that I want to open up a 2nd GUI, and after logging in I want to close it and go back to the first GUI. Here's my code: expandcollapse popup#include <GUIConstantsEx.au3> #include <ButtonConstants.au3> #include <IE.au3> HotKeySet("{`}", "Show") Global $PanTask, $PanGUI, $CreateWindow, $LoginButton, $TrainButton, $Gui2 Opt("GUIOnEventMode", 1) $Gui = GuiCreate("Trainer",300,200) GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked") GUICtrlCreatePic("Background.jpg", 0, 0, 300, 200) GUICtrlSetState(-1, $GUI_DISABLE) $LoginButton = GuiCtrlCreateButton("Login", 10, 90, 62, 32, $BS_BITMAP) GUICtrlSetImage(-1, "C:\Users\***\Documents\Website\Training\Login.bmp", 22) GUICtrlSetOnEvent($LoginButton, "Login") $TrainButton = GuiCtrlCreateButton("Train", 200, 90, 62, 32, $BS_BITMAP) GUICtrlSetImage(-1, "C:\Users\***\Documents\Website\Training\Train.bmp", 22) GUICtrlSetOnEvent($TrainButton, "Train") GUISwitch($Gui) GUISetState(@SW_SHOW) While 1 Sleep(1000) ; Idle around WEnd Func Login() $Gui2 = GuiCreate("Login", 200, 200) GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked") GUISwitch($Gui2) GuiSetState(@SW_SHOW) EndFunc Func Train() MsgBox(0, "GUI Event", "You pressed train") EndFunc Func Show() GuiSetState(@SW_SHOW) EndFunc Func CLOSEClicked() If @GUI_WINHANDLE = $Gui Then MsgBox(0, "Test", "You clicked on 1st window") Exit EndIf If @GUI_WINHANDLE = $Gui2 Then MsgBox(0, "Test", "You clicked on 2nd window") EndIf EndFunc So, when you click "Login" it will open a 2nd GUI, and when I click close I want it to only close this GUI, not exit like the first one. Thanks! Most recent sig. I made Quick Launcher W/ Profiles Topic Movie Database Topic & Website | LiveStreamer Pro Website | YouTube Stand-Alone Playlist Manager: Topic | Weather Desktop Widget: Topic | Flash Memory Game: Topic | Volume Control With Mouse / iTunes Hotkeys: Topic | Weather program: Topic | Paws & Tales radio drama podcast mini-player: Topic | Quick Math Calculations: Topic
Foxhound Posted November 27, 2010 Posted November 27, 2010 (edited) Try GUISetState(@SW_HIDE,$guiHandle) where $guiHandle is your handle to the GUI you want to close Edited November 27, 2010 by Foxhound [quote]Quick YouTube To MP3 | Lyrics Finder | Internet Radio Player | GetWeather | TinyURLifier[/quote]
Moderators Melba23 Posted November 27, 2010 Moderators Posted November 27, 2010 Damein,Look at the Managing Multiple GUIs tutorial in the Wiki. It shows you how you do what you want. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
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