ChrisFromBoston Posted March 11, 2016 Posted March 11, 2016 Hi Everyone, I have a standard tray item with multiple submenus with radio options. Changing any of those submenu radio options closes the entire menu tree. I'd like users of my script to be able to continue to browse the submenus after picking one, so I'd prefer it didn't close. Any way I can make this change?
AutoBert Posted March 11, 2016 Posted March 11, 2016 I see nothing to change, maybe the bug is in line 14.
InunoTaishou Posted March 11, 2016 Posted March 11, 2016 I'm sure there is a way to do it but I wouldn't know how. I don't know of any windows message to register with GUIRegisterMsg because you're talking about the tray menu, which is apart of the notification area. What I think you would have to do is something like this. And you can use $hSysTray_Handle = ControlGetHandle('[Class:NotifyIconOverflowWindow]', '', '[Class:ToolbarWindow32;Instance:1]') To get all the icon titles in the overflow notification area. You'll have to intercept when the user clicks on a button in your tray menu, and when right-click it in your code. Honestly, this seems bad. I'd use a context menu on your GUI instead, much simpler and cleaner. expandcollapse popup#include <GUIConstants.au3> #include <GUIMenu.au3> Local $hGUI = GUICreate("Example") Local $hMenu = GUICtrlCreateContextMenu() Local $idExample1 = GUICtrlCreateMenuItem("Example 1", $hMenu, 0) Local $idExample2 = GUICtrlCreateMenuItem("Example 2", $hMenu, 1) Local $idExample3 = GUICtrlCreateMenuItem("Example 3", $hMenu, 2) Local $aPosition = 0 GUISetState(@SW_SHOW, $hGUI) GUIRegisterMsg($WM_COMMAND, WM_COMMAND) GUIRegisterMsg($WM_CONTEXTMENU, WM_CONTEXTMENU) While (True) Switch (GUIGetMsg()) Case $GUI_EVENT_CLOSE GUIDelete($hGUI) Exit 0 EndSwitch WEnd Func WM_COMMAND($hWndFrom, $iMsg, $wParam, $lParam) #forceref $hWndFrom, $iMsg, $wParam Local $iIDFrom = BitAND($wParam, 0xFFFF) Switch ($hWndFrom) Case $hGUI If ($iIDFrom <= $idExample3 Or $idExample1 >= $iIDFrom) Then If (Not IsArray($aPosition)) Then Return -1 GUICtrlSetState($iIDFrom, BitXOR(GUICtrlRead($iIDFrom), $GUI_ENABLE, $GUI_UNCHECKED, $GUI_CHECKED)) _GUICtrlMenu_TrackPopupMenu(GUICtrlGetHandle($hMenu), $hWndFrom, $aPosition[0], $aPosition[1]) EndIf EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_COMMAND Func WM_CONTEXTMENU($hWndFrom, $iMsg, $wParam, $lParam) ; Just to track where the menu should be after clicking a button $aPosition = MouseGetPos() EndFunc ;==>WM_CONTEXTMENU
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