mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-10-02 18:10:07 +02:00
win32: change PopupMenu parent handle to ActiveCustomForm to support PM in DLL. Issue #18624
git-svn-id: trunk@52296 -
This commit is contained in:
parent
f479268ab4
commit
b33c0dba1b
@ -1565,7 +1565,7 @@ end;
|
||||
class procedure TWin32WSPopupMenu.Popup(const APopupMenu: TPopupMenu; const X, Y: integer);
|
||||
var
|
||||
MenuHandle: HMENU;
|
||||
AppHandle: HWND;
|
||||
WinHandle: HWND;
|
||||
const
|
||||
lAlignment: array[TPopupAlignment, Boolean] of DWORD = (
|
||||
{ left-to-rght } { right-to-left }
|
||||
@ -1579,11 +1579,14 @@ const
|
||||
);
|
||||
begin
|
||||
MenuHandle := APopupMenu.Handle;
|
||||
AppHandle := Win32WidgetSet.AppHandle;
|
||||
GetWin32WindowInfo(AppHandle)^.PopupMenu := APopupMenu;
|
||||
if (Screen.ActiveCustomForm<>nil) and Screen.ActiveCustomForm.HandleAllocated then
|
||||
WinHandle:=Screen.ActiveCustomForm.Handle
|
||||
else
|
||||
WinHandle:=Win32WidgetSet.AppHandle;
|
||||
GetWin32WindowInfo(WinHandle)^.PopupMenu := APopupMenu;
|
||||
TrackPopupMenuEx(MenuHandle,
|
||||
lAlignment[APopupMenu.Alignment, APopupMenu.IsRightToLeft] or lTrackButtons[APopupMenu.TrackButton],
|
||||
X, Y, AppHandle, nil);
|
||||
X, Y, WinHandle, nil);
|
||||
end;
|
||||
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user