FrozenTeeth 0 Posted October 15, 2010 If I right click the tray icon and select about it works multiple times. but If I try selecting 'settings' on the menu the GUI opens and allows me to save then close the GUI. But at that point none of the menu items work anymore. I tried reseting Opt("GUIOnEventMode", 1) to Opt("GUIOnEventMode", 0) when the gui exits and that doesn't work. Any ideas? expandcollapse popup#include <ButtonConstants.au3> #include <ComboConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <GUIComboBox.au3> #include <GuiComboBoxEx.au3> #include <WindowsConstants.au3> #include <Constants.au3> #include <_sql.au3>; #include <Array.au3> Opt("TrayMenuMode", 1) ; Hide default tray menu items TraySetIcon(@ScriptDir & "\0.ico") TraySetClick(8) ;only show the menu when right clicking Local $SleepStep, $aboutitem,$infoitem $aboutitem = TrayCreateItem("About") $infoitem = TrayCreateItem("Info") $exititem = TrayCreateItem("Exit") ; ; main routine ; While 1 Switch TrayGetMsg() ;switch seems nicer in this case Case 0 $SleepStep += 1 If $SleepStep > 1000 Then $SleepStep = 0 ;do something every cycle ; to be added later EndIf ContinueLoop Case $TRAY_EVENT_PRIMARYDOWN ;reaction to left clicking TrayTip("Tickets:", "you have new tickets", 5, 1) SetIcon() Case $aboutitem TrayItemSetState($aboutitem, $TRAY_UNCHECKED) ;stop the automated (un)checking when clicked MsgBox(64, "About", "Ticket Notification Utility") Case $infoitem TrayItemSetState($infoitem, $TRAY_UNCHECKED) ;stop the automated (un)checking when clicked OpenGUI() ;MsgBox(64, "POPUP", "setting change here") Case $exititem ExitLoop EndSwitch WEnd Exit Func SetIcon() ; testing Local $IconNumber = 5 Select Case $IconNumber < 1 TraySetIcon(@ScriptDir & "\0.ico") Case $IconNumber > 9 TraySetIcon(@ScriptDir & "\9plus.ico") Case Else TraySetIcon(@ScriptDir & "\" & $IconNumber & ".ico") EndSelect EndFunc ;==>SetIcon Func OpenGUI() Opt("GUIOnEventMode", 1) #region ### START Koda GUI section ### Form= $Form2 = GUICreate("Form2", 202, 125, 302, 218) GUISetOnEvent($GUI_EVENT_CLOSE, "Form2Close") GUISetOnEvent($GUI_EVENT_MINIMIZE, "Form2Minimize") GUISetOnEvent($GUI_EVENT_MAXIMIZE, "Form2Maximize") GUISetOnEvent($GUI_EVENT_RESTORE, "Form2Restore") $Label1 = GUICtrlCreateLabel("Settings:", 72, 16, 45, 17) GUICtrlSetOnEvent(-1, "Label1Click") $ButtonSave = GUICtrlCreateButton("Save", 64, 48, 73, 33, $WS_GROUP) GUICtrlSetOnEvent(-1, "ButtonSaveClick") GUISetState(@SW_SHOW) #endregion ### END Koda GUI section ### ;While 1 ; Sleep(100) ;WEnd Local $msg ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd return EndFunc ;==>OpenGUI Func ButtonSaveClick() ;test save settings MsgBox(0, "Saved:", "Your settings have been saved") GUISetState(@SW_HIDE) EndFunc ;==>ButtonSaveClick Func Form2Close() EndFunc ;==>Form2Close Func Form2Maximize() EndFunc ;==>Form2Maximize Func Form2Minimize() EndFunc ;==>Form2Minimize Func Form2Restore() EndFunc ;==>Form2Restore Func Label1Click() EndFunc ;==>Label1Click Share this post Link to post Share on other sites
nitekram 68 Posted October 15, 2010 (edited) You are trying to use both GUIOnEventMode and GUIGetMsg - not allowed to do that. EDIT so take out your ;While 1 ; $msg = GUIGetMsg() ; If $msg = $GUI_EVENT_CLOSE Then ExitLoop ;WEnd Edited October 15, 2010 by nitekram 2¢All by me:"Sometimes you have to go back to where you started, to get to where you want to go." "Everybody catches up with everyone, eventually" "As you teach others, you are really teaching yourself." From my dad "Do not worry about yesterday, as the only thing that you can control is tomorrow." WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit Docs SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDFLearning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language Programming TipsExcel ChangesControlHover.UDFGDI_PlusDraw_On_ScreenGDI BasicsGDI_More_BasicsGDI RotateGDI GraphGDI CheckExistingItemsGDI TrajectoryReplace $ghGDIPDll with $__g_hGDIPDllDLL 101?Array via ObjectGDI SwimlaneGDI Plus French 101 SiteGDI Examples UEZGDI Basic ClockGDI DetectionTernary operator Share this post Link to post Share on other sites
FrozenTeeth 0 Posted October 15, 2010 You are trying to use both GUIOnEventMode and GUIGetMsg - not allowed to do that. EDIT so take out your ;While 1 ; $msg = GUIGetMsg() ; If $msg = $GUI_EVENT_CLOSE Then ExitLoop ;WEnd Works like a charm! Thanks for the heads up/fix! Share this post Link to post Share on other sites
nitekram 68 Posted October 15, 2010 no problem - glad i could help for once 2¢All by me:"Sometimes you have to go back to where you started, to get to where you want to go." "Everybody catches up with everyone, eventually" "As you teach others, you are really teaching yourself." From my dad "Do not worry about yesterday, as the only thing that you can control is tomorrow." WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit Docs SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDFLearning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language Programming TipsExcel ChangesControlHover.UDFGDI_PlusDraw_On_ScreenGDI BasicsGDI_More_BasicsGDI RotateGDI GraphGDI CheckExistingItemsGDI TrajectoryReplace $ghGDIPDll with $__g_hGDIPDllDLL 101?Array via ObjectGDI SwimlaneGDI Plus French 101 SiteGDI Examples UEZGDI Basic ClockGDI DetectionTernary operator Share this post Link to post Share on other sites