I'm writing a custom component editor, essentially similar to TActionList
editor in that it allows creation of sub components.
Editor has buttons to add/delete components.
Now, I'd like to find out if selected component is inherited, so that I can disable the delete button.
I haven't found any such member in IDesigner
or related interfaces.
If I just go ahead and delete by Designer.DeleteSelection(True);
then I get an exception:
Selection contains a component, xxx, introduced in an ancestor and cannot be deleted.
Which is not too bad, but I'd prefer to disable the delete button in the first place.
Ok, so apparently there is a way, by checking the TComponent.ComponentState
for csAncestor
, so:
csAncestor in ComponentState
And it's documented:
csAncestor - The component was introduced in an ancestor form. Only set if csDesigning is also set.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With