Link to home
Start Free TrialLog in
Avatar of EricTaylor
EricTaylor

asked on

base control that has a popupMenu

A function in one of my Delphi 2010 libraries creates a TPopupMenu on the fly. I need to create a procedure that lets me pass a control to associate the menu with. For example, a TEdit has a PopupMenu property, as does a TMemo, a TcxDbTreeList, etc. I obviously don't want to write a separate overloaded procedure for every control type that I'll ever want to associate my menu with, but I can't figure out what base class that lets me set the Popupmenu property. For example, I can't write
if Sender is TWinControl then TWinControl(Sender).popupMenu := myMenu;

Open in new window

because TWinControl doesn't have the PopupMenu property. What class base supports the PopupMenu property?. Ā Thanks much.
ASKER CERTIFIED SOLUTION
Avatar of Sinisa Vuk
Sinisa Vuk
Flag of Croatia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of EricTaylor
EricTaylor

ASKER

Thanks, Sinisa. In this case, I only need to pass one TControl, but this was helpful in getting and setting the desired property. (Seems a little convoluted that those properties would be that awkward to get to, but that's another issue.)