Search the Community
Showing results for tags 'mns_modeless'.
-
I have several context menus that's been built using _GUICtrlMenu_CreatePopup() and _GUICtrlMenu_AddMenuItem(). When using _GUICtrlMenu_CreatePopup() it returns the identifier of the clicked item, sure. But it blocks the main loop while the menu is open. When using _GUICtrlMenu_CreatePopup($MNS_MODELESS) it returns immediately (of course), but I cannot figure out how/where to read the item that was clicked. Is there a Windows Message (WM) somewhere that is triggered? I've spend an entire day trying to figure out how to do this, but I'm not getting anywhere. My google fu is depleted (I must have tried like hundreds of script variations today), I'm about to smash my keyboard and just go to bed, and abandon the entire endeavor of making pretty menus and go back to using Koda and forget about using menu icons, colors, etc. Anyone wanna help me out with how to read the clicked item? Before I smash my keyboard, please... Example script here: #include <GuiMenu.au3> #include <WinAPIError.au3> #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> GUIRegisterMsg($WM_CONTEXTMENU, "_WM_CONTEXTMENU") Global $idMenuItem = 10000, $counter = 0 Global $hGUI = GUICreate("Menu test", 400, 300) Global $hListview = GUICtrlCreateListView("", 2, 2, 396, 200) GUISetState(@SW_SHOW) ;~ Global $hMenuContext = _GUICtrlMenu_CreatePopup() Global $hMenuContext = _GUICtrlMenu_CreatePopup($MNS_MODELESS) _GUICtrlMenu_AddMenuItem($hMenuContext, "Menu item", $idMenuItem) Global $hTimer = TimerInit() Do If TimerDiff($hTimer)>200 Then $counter += 1 ConsoleWrite($counter & " " ) $hTimer = TimerInit() EndIf Until GUIGetMsg() = $GUI_EVENT_CLOSE Exit Func _WM_CONTEXTMENU($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $lParam Switch $wParam Case GUICtrlGetHandle($hListview) ConsoleWrite( @CRLF & "_GUICtrlMenu_TrackPopupMenu = " & _GUICtrlMenu_TrackPopupMenu($hMenuContext, $wParam, -1, -1, 1, 1, 2) & @CRLF) EndSwitch EndFunc
- 1 reply
-
- mns_modeless
- context
-
(and 3 more)
Tagged with: