byronsmith Posted February 21, 2014 Share Posted February 21, 2014 (edited) Hey Fella's, A little confuzzled here. On the try icon I can only perform 'Settings' once. i.e I click Settings-><enter input>->Click save-><output message box appears>->Close MsgBox->Close GUI. If I try the sequence again I cannot get the Settings GUI to reappear, nor can I exit. I did some debugging and it seems I am stuck in the second While loop, even if I add ExitLoop to the GUI_EVENT_CLOSE case Any advice to make this work while calling the GUI from within a function? What schoolboy error am I making? Cheers Byron expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> ;; Various options AutoItSetOption ("TrayIconDebug", 1) AutoItSetOption ("TrayMenuMode",1) AutoItSetOption ("MustDeclareVars",0) $settings = TrayCreateItem("Settings") $exit = TrayCreateItem("Exit") While 1 Switch TrayGetMsg() Case $settings Settings() Case $exit Exit EndSwitch WEnd Func Settings() GUICreate("Settings", 231, 229, 321, 495) $input = GUICtrlCreateInput("", 75, 135, 145, 21) $save = GUICtrlCreateButton("Save", 71, 195, 73, 25) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE GUIDelete() Case $save MsgBox(0,"Output",GUICtrlRead($input)) EndSwitch WEnd EndFunc Edited February 21, 2014 by byronsmith Link to comment Share on other sites More sharing options...
Solution FireFox Posted February 21, 2014 Solution Share Posted February 21, 2014 (edited) Hi, Well that's simple, when you close the settings GUI you don't Exit your subloop so it continues looping. ... Func Settings() GUICreate("Settings", 231, 229, 321, 495) $input = GUICtrlCreateInput("", 75, 135, 145, 21) $save = GUICtrlCreateButton("Save", 71, 195, 73, 25) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE GUIDelete() ExitLoop ;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Case $save MsgBox(0,"Output",GUICtrlRead($input)) EndSwitch WEnd EndFunc _ Br, FireFox. Edited February 21, 2014 by FireFox Link to comment Share on other sites More sharing options...
byronsmith Posted February 21, 2014 Author Share Posted February 21, 2014 (edited) Well I'll be... I'm fairly certain I tried that obvious solution, even mention it in my OP! My sincerest apologies for wasting your time and many many thanks for taking the time to reply. I really do appreciate it. All the best. Actually, whilst I'm here and as you've been so kind as to answer my question, would you mind showing me how to remove the 'tick' next to the tray menu options? When I select settings there is a tick? Edited February 21, 2014 by byronsmith Link to comment Share on other sites More sharing options...
byronsmith Posted February 21, 2014 Author Share Posted February 21, 2014 Nevermind TrayMenuMode Thanks again. 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