closing two gui at once Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
barbaque
Posts: 18
Joined: 03 Jul 2020, 03:30

closing two gui at once

10 Jul 2020, 13:36

Is there any way to close 2 guis at once? For example i have two Guis that are stacked so the bottom one can be click through and my top Gui has my menu functions. is there any way i can close/hide them both at once with a menu button? when i try it only hides the active gui. thank you!
User avatar
boiler
Posts: 5661
Joined: 21 Dec 2014, 02:44

Re: closing two gui at once

10 Jul 2020, 14:17

Just have the routine Cancel both GUIs like this:

Code: Select all

Menu, FileMenu, Add, Close, CloseGUIs
Menu, MenuBar, Add, File, :FileMenu
Gui, Main:Add, Text,, My GUI
Gui, Main:Menu, MenuBar

Gui, Second:Color, White
Gui, Second:Add, Text, y200, Secondary GUI

Gui, Second:Show, x500 y600 w300 h300
Gui, Main:Show, x500 y500 w300 h100
return

CloseGUIs:
	Gui, Main:Cancel
	Gui, Second:Cancel
	MsgBox, Both Gui's are closed but script is still running
	ExitApp
return
barbaque
Posts: 18
Joined: 03 Jul 2020, 03:30

Re: closing two gui at once  Topic is solved

10 Jul 2020, 15:06

Thank you for your reply but that did not work. I did however figure it out myself by utilizing both "gui hide" to hide my active gui then winclose to hide the second one.
User avatar
boiler
Posts: 5661
Joined: 21 Dec 2014, 02:44

Re: closing two gui at once

10 Jul 2020, 15:11

Why wouldn’t that work? The demo script itself works. Did you run that and see how it works? You just need to use the proper GUI labels with Gui Cancel.
barbaque
Posts: 18
Joined: 03 Jul 2020, 03:30

Re: closing two gui at once

10 Jul 2020, 15:13

lol damn i feel like an idiot now, no i did not use the proper labels

Return to “Ask For Help”

Who is online

Users browsing this forum: AHKStudent, badda, boiler, colmik, Epialis, kczx3, labrint, sobuj53 and 58 guests