Code: Select all
if not (csDesigning in ComponentState) then
begin
if (Message.Msg = WM_RBUTTONUP) then
begin
if Assigned(PopupMenu) then
begin
Point.X := Message.LParamLo;
Point.Y := Message.LParamHi;
Point := Self.ClientToScreen(Point);
PopupMenu.Popup(Point.X, Point.Y);
Exit;
end;
end;
When you call PopupMenu.Popup like this, it doesn't set PopupComponent. There are also some other things like checking for AutoPopup that are normally done by a TControl.
So instead, I propose this code replace the former:
Code: Select all
if (Message.Msg = WM_RBUTTONUP) then
begin
Point.X := Message.LParamLo;
Point.Y := Message.LParamHi;
Point := Self.ClientToScreen(Point);
Message.Result := Perform(WM_CONTEXTMENU, Message.WParam, MakeLParam(Point.X, Point.Y));
Exit;
end;
This would allow it to be processed just like a normal context menu click. Don't worry about ComponentState, the TControl checks that.
A similar thing needs to change in TTransparentFlashPlayerControl.ParentWndProc
Code: Select all
if ((Message.Msg = WM_KEYDOWN) And (Message.WParam = VK_APPS) And (Not FStandartMenu)) then Exit;
By exiting on the VK_APPS key, you prevent being able to use a popup menu with the control that can be brought up with the apps key.
It should change to:
Code: Select all
if (Message.Msg = WM_KEYDOWN) And (Message.WParam = VK_APPS) then
if PopupMenu <> nil then
begin
Message.Result := Perform(WM_CONTEXTMENU, Message.WParam, MakeLParam(Word(-1), Word(-1)));
Exit;
end
else if not StandartMenu then
Exit;
This allows the underlying context menu event be properly processed.
I'd love to see these changes in the next version or otherwise relatively soon. This is the only thing holding me up from posting my ExternalPopupMenus code. It's some pretty cool code that lets you define and connect popup menus in Flex and have Delphi pop them up. It includes icons and submenus and has no restrictions like always having "About" and "Settings..." menu options.