Internet Direct (Indy)
Home
PreviousUpNext
TIdInitializerComponent Class

Ancestor for Indy component classes that accounts for differences between constructors in .Net and VCL.

Pascal
[DesignTimeVisible(false), ToolboxItem(false)]
TIdInitializerComponent = class(TIdNativeComponent);

TIdInitializerComponent is a TIdNativeComponent descendant that acts as an ancestor class for Indy components. TIdInitializerComponent is used to consolidate differences between constructors as implemented in the .Net and VCL environments. 

In the .Net environment, constructors (for visual components) are generally called without arguments. In the VCL environment, constructors (for visual components) are generally called with an owner for free notifications. 

TIdInitializerComponent accounts for these differences by implementing overloaded constructors for both platforms that accept the expected arguments. 

TIdInitializerComponent also implements the protected virtual procedure InitComponent which eliminates the need for overridden constructors in descendant classes used as visual components. Descendant classes can override the InitComponent method to perform component initialization operations that were traditionally reserved for overridden (or overloaded) constructors.

For the .Net environment, initialization sections are not called unless a reference has been added for the unit. Delphi for .NET makes initializations and globals part of a "Unit" class. So initialization sections wont get called until the Unit class is used. Delphi 8, 2005, and 2006 EXEs are ok, but assemblies (ie VS.NET and probably asms in some cases when used from a D8 EXE) do not call their initialization sections. InitComponent is used to loop through the list of classes in the assembly, and for each named Unit the class constructor which causes the initialization section to be called.

Internet Direct (Indy) version 10.1.5
Copyright © 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved.
Website http://www.indyproject.org.
Post feedback to the Indy Documentation newsgroup.