views:

143

answers:

2

I have a Delphi 2007 VCL TPanel with a TPopupMenu assigned to it. There are some TEdit controls on the panel. The edits inherit the popup menu of the parent panel. I want to not allow this popup inheriting, so the edits will show the default Windows TEdit popup menu with Copy, Cut, Paste, etc., but have not found a way to do it yet. There doesn't appear to be a "ParentPopupMenu" type property to set which controls inherit it from the parent component.

+3  A: 

Try setting the PopupMenu's AutoPopup property to False, and then manually Popup() the menu when needed, since as in the TPanel's OnContextMenu event.

Remy Lebeau - TeamB
Thanks, this OnContextPopup code seems to work: var Control: TControl; begin Control := FindVCLWindow(Mouse.CursorPos) ; if Control = MyPanel then begin MyMenu.Popup(Mouse.CursorPos.X, Mouse.CursorPos.Y); Handled := True; end; end;
Anagoge
+4  A: 

This is QC#54286: Parent-PopupMenu overrides standard context menu. Andreas Hausladen's VCL Fix Pack fixes the issue so it works the way you're expecting it to.

Craig Peterson
Thanks for the links. It is good to know I'm not alone in considering this a bug. Hopefully Embarcadero will eventually agree. I decided to go with the AutoPopup fix, since I wanted the simplest possible fix, and I only need it on one form.
Anagoge