win32: applied better patch for PM parent from Tomasz Wieckowski. Issue #18624

git-svn-id: trunk@52298 -
This commit is contained in:
ondrej 2016-05-10 19:59:48 +00:00
parent d41a4438c1
commit 3d8cc7c21c

View File

@ -1579,10 +1579,9 @@ const
);
begin
MenuHandle := APopupMenu.Handle;
if IsLibrary and (Screen.ActiveCustomForm<>nil) and Screen.ActiveCustomForm.HandleAllocated then
WinHandle:=Screen.ActiveCustomForm.Handle
else
WinHandle:=Win32WidgetSet.AppHandle;
WinHandle:=Win32WidgetSet.AppHandle;
if (WinHandle=0) and (Screen.ActiveCustomForm<>nil) and Screen.ActiveCustomForm.HandleAllocated then
WinHandle:=Screen.ActiveCustomForm.Handle;
GetWin32WindowInfo(WinHandle)^.PopupMenu := APopupMenu;
TrackPopupMenuEx(MenuHandle,
lAlignment[APopupMenu.Alignment, APopupMenu.IsRightToLeft] or lTrackButtons[APopupMenu.TrackButton],