LCL-Win32: Call OnClick of a parent menuitem from submenu of a popupmenu. Issue #35219, patch from Benito van der Zander.

git-svn-id: trunk@60679 -
This commit is contained in:
juha 2019-03-15 11:45:32 +00:00
parent ab1727e00b
commit f9b4f6ae8d

View File

@ -401,14 +401,18 @@ end;
function TWindowProcHelper.GetPopMenuItemObject: TObject;
var
MainMenuHandle: HMENU;
MenuHandle: HMENU;
MenuInfo: MENUITEMINFO;
begin
MenuInfo.cbSize := MMenuItemInfoSize;
MenuInfo.fMask := MIIM_DATA;
MainMenuHandle := GetMenuParent(HMENU(WParam), GetMenu(Window));
if GetMenuItemInfo(MainMenuHandle, LOWORD(LParam), true, @MenuInfo) then
MenuHandle := 0;
if Assigned(WindowInfo^.PopupMenu) then
MenuHandle := GetMenuParent(HMENU(WParam), WindowInfo^.PopupMenu.Handle);
if MenuHandle = 0 then
MenuHandle := GetMenuParent(HMENU(WParam), GetMenu(Window));
if GetMenuItemInfo(MenuHandle, LOWORD(LParam), true, @MenuInfo) then
Result := TObject(MenuInfo.dwItemData)
else
Result := nil;