Delphi designer, is a component inherited?

I am writing a custom component editor, essentially similar to the TActionList editor, which allows you to create subcomponents. The editor has buttons for adding / removing components.

Now I would like to know if the selected component is inherited so that I can disable the delete button. I did not find such a member in IDesigner or its related interfaces.

If I just go ahead and delete using Designer.DeleteSelection(True); , then I get an exception:

The selection contains the xxx component entered in the ancestor and cannot be removed.

This is not so bad, but I would prefer to disable the delete button first.

+6
source share
1 answer

Ok, so there seems to be a way by checking TComponent.ComponentState for csAncestor , therefore:

csAncestor in ComponentState

And this is documented :

csAncestor - the component was introduced in the form of an ancestor. Only if csDesigning is also specified.

+8
source

All Articles