FrozenTeeth Posted October 15, 2010 Share 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 Link to comment Share on other sites More sharing options...
nitekram Posted October 15, 2010 Share 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 2 AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit Docs SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language Programming Tips Excel Changes ControlHover.UDF GDI_Plus Draw_On_Screen GDI Basics GDI_More_Basics GDI Rotate GDI Graph GDI CheckExistingItems GDI Trajectory Replace $ghGDIPDll with $__g_hGDIPDll DLL 101? Array via Object GDI Swimlane GDI Plus French 101 Site GDI Examples UEZ GDI Basic Clock GDI Detection Ternary operator Link to comment Share on other sites More sharing options...
FrozenTeeth Posted October 15, 2010 Author Share 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! Link to comment Share on other sites More sharing options...
nitekram Posted October 15, 2010 Share 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 2 AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit Docs SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language Programming Tips Excel Changes ControlHover.UDF GDI_Plus Draw_On_Screen GDI Basics GDI_More_Basics GDI Rotate GDI Graph GDI CheckExistingItems GDI Trajectory Replace $ghGDIPDll with $__g_hGDIPDll DLL 101? Array via Object GDI Swimlane GDI Plus French 101 Site GDI Examples UEZ GDI Basic Clock GDI Detection Ternary operator 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