delphiactivexdatamodule

Delphi Component Disappears from Component Palette in new Data Module


The declaration of my component is:

MyComponentX = class(TActiveXComponent, IspdInterfaceX)

TActivexComponent:

TActiveXComponent = class(TActiveXControl, IOleControl) 

When I open a new DataModule in any Delphi version, the component disappears from the Component Palette.

I try to change the ClassGroup in Delphi XE2, but this don't works.


Solution

  • Data modules can only host non-visual controls, and TActiveXControl is not a non-visual control.

    You ask what is the definition of non-visual control. According to this article, the definition is that if the component is derived from TComponent and not derived from TControl, then it is a non-visual control.

    That said, the inheritance hierarchy for TActiveXControl is: TObject, TComObject, TTypedComObject, TAutoObject, TActiveXControl. So I am at something of a loss at to why it ever appears on your component palette since it is not derived from TComponent. It would be interesting to know how you registered it. All the same, it's not a non-visual component in the meaning of the act.