View Issue Details

IDProjectCategoryView StatusLast Update
0035219PatchesPatchpublic2019-03-15 12:45
ReporterBenito van der ZanderAssigned ToJuha Manninen 
PrioritynormalSeverityminorReproducibilityhave not tried
Status resolvedResolutionfixed 
Product Version2.0Product BuildLazarus 2.0.0 r55664M FPC 3.3.1  
Target VersionFixed in Version 
Summary0035219: OnClick on opened submenu in popupmenu
DescriptionWhen a submenu in a popupmenu is opened, it needs to call onclick of the parent menuitem
TagsNo tags attached.
Fixed in Revisionr60679
LazTarget-
WidgetsetWin32/Win64
Attached Files
  • popupmenu.patch (999 bytes)
    Index: lcl/interfaces/win32/win32callback.inc
    ===================================================================
    --- lcl/interfaces/win32/win32callback.inc	(Revision 60475)
    +++ lcl/interfaces/win32/win32callback.inc	(Arbeitskopie)
    @@ -401,14 +401,18 @@
     
     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;
    
    popupmenu.patch (999 bytes)

Activities

Benito van der Zander

2019-03-13 12:30

reporter  

popupmenu.patch (999 bytes)
Index: lcl/interfaces/win32/win32callback.inc
===================================================================
--- lcl/interfaces/win32/win32callback.inc	(Revision 60475)
+++ lcl/interfaces/win32/win32callback.inc	(Arbeitskopie)
@@ -401,14 +401,18 @@
 
 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;
popupmenu.patch (999 bytes)

Juha Manninen

2019-03-15 12:45

developer   ~0114836

Applied, thanks.

Issue History

Date Modified Username Field Change
2019-03-13 12:30 Benito van der Zander New Issue
2019-03-13 12:30 Benito van der Zander File Added: popupmenu.patch
2019-03-15 12:42 Juha Manninen Assigned To => Juha Manninen
2019-03-15 12:42 Juha Manninen Status new => assigned
2019-03-15 12:45 Juha Manninen Fixed in Revision => r60679
2019-03-15 12:45 Juha Manninen LazTarget => -
2019-03-15 12:45 Juha Manninen Note Added: 0114836
2019-03-15 12:45 Juha Manninen Status assigned => resolved
2019-03-15 12:45 Juha Manninen Resolution open => fixed