PartyPooper Posted May 31, 2008 Share Posted May 31, 2008 For some reason, I can't seem to get little ticks in the Menu bar. The menuitem will trigger the event when clicked but it won't add the check mark to the menubar (it does to the tray without problem) so I'm wondering if its a problem with Autoit 3.2.12.0 or some Windows XP setting I've missed. Here's some code to get an idea: CODE Func MainGUI() $h_MainGUI = GUICreate($s_Title, 800, 630, $i_WinXPos, $i_WinYPos) GUISetOnEvent($GUI_EVENT_CLOSE, "OnExit", $h_MainGUI) Local $h_OptionsMenu = GUICtrlCreateMenu("&Options") Local $h_AutoStartMenuItem = GUICtrlCreateMenuItem("Auto &Start", $h_OptionsMenu) GUICtrlSetOnEvent($h_AutoStartMenuItem, "OnAutoStart") If $i_AutoStart = 0 Then GUICtrlSetState($h_AutoStartMenuItem, $GUI_UNCHECKED) Else GUICtrlSetState($h_AutoStartMenuItem, $GUI_CHECKED) EndIf GUISetState(@SW_SHOW, $h_MainGUI) EndFunc Func OnAutoStart() If $i_AutoStart = 0 Then $i_AutoStart = 1 TrayItemSetState($h_AutoStartTrayItem, $TRAY_CHECKED) GUICtrlSetState($h_AutoStartMenuItem, $GUI_CHECKED) ; modify registery here Else $i_AutoStart = 0 TrayItemSetState($h_AutoStartTrayItem, $TRAY_UNCHECKED) GUICtrlSetState($h_AutoStartMenuItem, $GUI_UNCHECKED) ; modify registery here EndIf EndFunc #cs The tray code goes something like this and it works fine. As you can see, it's nearly identical to the menu code: $h_AutoStartTrayItem = TrayCreateItem("Auto Start", $h_SettingsMenu) TrayItemSetOnEvent($h_AutoStartTrayItem, "OnAutoStart") If $i_AutoStart = 0 Then TrayItemSetState($h_AutoStartTrayItem, $TRAY_UNCHECKED) Else TrayItemSetState($h_AutoStartTrayItem, $TRAY_CHECKED) EndIf #ce Any ideas or obvious things I've overlooked? Link to comment Share on other sites More sharing options...
PartyPooper Posted June 1, 2008 Author Share Posted June 1, 2008 No one? Link to comment Share on other sites More sharing options...
rasim Posted June 1, 2008 Share Posted June 1, 2008 (edited) PartyPooperHi! Works fine for me:#include <GUIConstantsEx.au3> Opt("GuiOnEventMode", 1) $h_MainGUI = GUICreate("Test GUI", 800, 630) GUISetOnEvent($GUI_EVENT_CLOSE, "OnExit") Local $h_OptionsMenu = GUICtrlCreateMenu("&Options") Local $h_AutoStartMenuItem = GUICtrlCreateMenuItem("Auto &Start", $h_OptionsMenu) GUICtrlSetOnEvent(-1, "OnAutoStart") If $i_AutoStart = 0 Then GUICtrlSetState($h_AutoStartMenuItem, $GUI_UNCHECKED) Else GUICtrlSetState($h_AutoStartMenuItem, $GUI_CHECKED) EndIf GUISetState(@SW_SHOW, $h_MainGUI) Do Sleep(100) Until False Func OnAutoStart() If BitAND(GUICtrlRead(@GUI_CtrlId), $GUI_CHECKED) Then GUICtrlSetState($h_AutoStartMenuItem, $GUI_UNCHECKED) Else GUICtrlSetState($h_AutoStartMenuItem, $GUI_CHECKED) EndIf EndFunc Func OnExit() Exit EndFunc Edited June 1, 2008 by rasim Link to comment Share on other sites More sharing options...
PartyPooper Posted June 2, 2008 Author Share Posted June 2, 2008 Yep, works for me too - damn. Means more debugging for me as something is interferring Thanks Rasim. Link to comment Share on other sites More sharing options...
PartyPooper Posted June 2, 2008 Author Share Posted June 2, 2008 Found the error - I declared $h_AutoStartMenuItem as both local and global - DUH! Link to comment Share on other sites More sharing options...
GHOSTSKIKDA Posted June 2, 2008 Share Posted June 2, 2008 Hi! There is a problem in (If $i_AutoStart =) [center]I LOVE ALGERIA .... ;-)[/center] 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