I have a custom made control that inherits from Vcl.Controls.TCustomControl
I would like to assign a TPopupMenu
instance to it but that doesn't work, because PopupMenu appears to be not accessible.
I'm not sure why that is ? The online documentation seems to suggest PopupMenu is available in TCustomControl ?
However __property TPopupMenu* PopupMenu = {read=FPopupMenu, write=SetPopupMenu};
is protected
I redefined the property as public
in the custom made control
But now the error is that SetPopupMenu
is not accessible. SetPopupMenu
is not listed as protected
. Perhaps private
? I'm not seeing it in the documentation.
Is this a virtual implementation and is it as simple as adding a TPopupMenu
member and writing a SetPopupMenu
function myself ? What am I missing ?
The PopupMenu
property is protected
in TControl
and not promoted in TCustomControl
. So you need to promote it to public
/__published
in your derived class, but do not redeclare it entirely, which it sounds like you are trying to do.
And yes, SetPopupMenu()
is private
(in TControl
) and thus is not accessible to derived classes.
Try this:
class TMyControl : public TCustomControl
{
...
__published:
__property PopupMenu; // <-- that is all you need!
};
The same goes for any other protected
base property that you want to expose access to in your derived control.