how to quit a gui
how to quit a gui
what do you have to do, that when you click the GUI "X", like all PC apps, the gui quits and goes away and the ICON is NOT in the HIDDEN icons window. Thanks for any help.
Re: how to quit a gui
From here:
Code: Select all
MyGui := Gui()
MyGui.AddText("", "Press Alt+F4 or the X button in the title bar.")
MyGui.OnEvent("Close", MyGui_Close)
MyGui_Close(thisGui) { ; Declaring this parameter is optional.
if MsgBox("Are you sure you want to close the GUI?",, "y/n") = "No"
return true ; true = 1
}
MyGui.Show
____________________________________
Check out my site, submeg.com
Connect with me on LinkedIn
Courses on AutoHotkey
Check out my site, submeg.com
Connect with me on LinkedIn
Courses on AutoHotkey
Re: how to quit a gui
my gui is call Main
here is what I did
I dont need the reminder window
the gui window closes
the icon is still in the hidden icons window
here is what I did
I dont need the reminder window
the gui window closes
the icon is still in the hidden icons window
Code: Select all
Main.OnEvent("Close", Main_Close)
Main_Close(thisGui) { ; Declaring this parameter is optional.
if MsgBox("Are you sure you want to close the GUI?",, "y/n") = "No"
return true ; true = 1
}
Main.Show
Re: how to quit a gui
Do you mean the AHK script icon (i.e. the script is still running when you close the GUI)?
If that's the case, you just need to add an ExitApp:
Code: Select all
Main.OnEvent("Close", Main_Close)
Main_Close(thisGui) { ; Declaring this parameter is optional.
if MsgBox("Are you sure you want to close the GUI?",, "y/n") = "No"
return true ; true = 1
ExitApp
}
Main.Show
____________________________________
Check out my site, submeg.com
Connect with me on LinkedIn
Courses on AutoHotkey
Check out my site, submeg.com
Connect with me on LinkedIn
Courses on AutoHotkey
Re: how to quit a gui
there has to be more to it than that, right. Or if I put ExitApp: at the every end of the script, the app completely quits and closes. I'll get back to you.
Re: how to quit a gui
The system tray icon (as opposed to a taskbar icon) usually goes away when the script is closed, not when one of its windows is closed, which is why submeg suggested what he did. You can set it not to show while the script is running if you want by assigning 1 to A_IconHidden. You can restore it by assigning 0 to it.
Re: how to quit a gui
Script Startup (the Auto-execute Thread)
terminates the script when the Gui is closed and removes the icon from the tray.
If your script is persistent for some reason, you need ExitApp to terminate.
Actually, the sample posted by @submegThe script will terminate after completing startup if it lacks hotkeys, hotstrings, visible GUIs, active timers, clipboard monitors and InputHooks, and has not called the Persistent function. Otherwise, it will stay running in an idle state, responding to events such as hotkeys, hotstrings, GUI events, custom menu items, and timers. If these conditions change after startup completes (for example, the last timer is disabled), the script may exit when the last running thread completes or the last GUI closes.
Code: Select all
MyGui := Gui()
MyGui.AddText("", "Press Alt+F4 or the X button in the title bar.")
MyGui.OnEvent("Close", MyGui_Close)
MyGui_Close(thisGui) { ; Declaring this parameter is optional.
if MsgBox("Are you sure you want to close the GUI?",, "y/n") = "No"
return true ; true = 1
}
MyGui.Show
If your script is persistent for some reason, you need ExitApp to terminate.
Who is online
Users browsing this forum: akirofe, bob65536, jsong55, pedro45_vs and 35 guests