|Subject:||Re: Why in Indy10 doesn't my component's constructor get called?|
|Posted by:||Remy Lebeau (TeamB) (email@example.com)|
|Date:||Fri, 13 Jan 2006|
"Warren Postma" <…@tekran.com> wrote in message
> I'm trying to convert a component that inherits from TIdBaseComponent
> from Indy9 to Indy10 and I've noticed that my constructor (Create) not
> only doesn't get called, it's not even LINKED into my application.
Indy 10 has a different construction architecture, mainly because of .NET
> How am I supposed to set up my component if I can't add stuff to
> my own component via the constructor?
Had you read the comments in IdBaseComponent.pas more carefully, you would
have noticed this statement:
// TIdInitializerComponent exists to consolidate creation differences
between .net and vcl.
// It looks funny, but because of .net restrictions on constructors we
have to do some wierdo
// stuff to catch both constructors.
// TIdInitializerComponent implements InitComponent which all components
must use to initialize
// other members instead of overriding constructors.
Which means that in Indy 10, you need to override the InitComponent() method
and place your code there instead of in the constructor directly. You will
notice that all of Indy's native components do this.
Why in Indy10 doesn't my component's constructor get called? posted by Warren Postma on Fri, 13 Jan 2006