Noob Posted December 27, 2006 Posted December 27, 2006 Hi Guys, I've spent the better part of today trying to figure out how to close my GUI without exiting my script. I read the help, I searched the Forum, but I'm just too new to this to get to the bottom of this myself. Here is the simplification of my code. I have a script that does a variety of things, one of which should be a function which will create a GUI. When I click the close button in the top right corner of the GUI, I want the GUI to close, but I don't want the script to exit. Any help would be greatly appreciated. HotKeySet("{F2}", "my_gui") While 1 $msg = GUIGetMsg() If $msg = -3 Then Exit Sleep(100) WEnd Func my_gui() GUICreate("My 1st GUI :-)") GUISetState () EndFunc
strate Posted December 27, 2006 Posted December 27, 2006 GUISetState (@SW_HIDE) ?? INI TreeViewA bus station is where a bus stops, a train station is where a train stops. Onmy desk I have a work station...
Noob Posted December 27, 2006 Author Posted December 27, 2006 GUISetState (@SW_HIDE)??It works!LOL, I'm an idiot :-)Thanks much!
Helge Posted December 27, 2006 Posted December 27, 2006 Note that if you press F2 multiple times you will get multiple GUIs. I modified the script a bit, so that if press close the GUI it will be hidden, while you can make it visible again by pressing F2. I also made it impossible to press F2 while the GUI is visible, avoiding having multiple GUIs at the same time. Kind of guessing what you want, but it might be of some help. GUICreate("My 1st GUI :-)") ; Create it once in the beginning without showing it HotKeySet("{F2}", "my_gui") While 1 $msg = GUIGetMsg() If $msg = -3 Then GUISetState(@SW_HIDE) ; Hide GUI HotKeySet("{F2}", "my_gui") ; Enable hotkey EndIf WEnd Func my_gui() GUISetState(@SW_SHOW) ; Show GUI HotKeySet("{F2}") ; Disable hotkey EndFunc
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