[lazarus] Interface Initialization

Mattias Gaertner nc-gaertnma at netcologne.de
Sun Nov 24 03:52:04 EST 2002

On Sat, 23 Nov 2002 22:33:48 +0100
"Vincent Snijders" <vslist at zonnet.nl> wrote:

> I have seen that constructor and destructor of the gtk-interface objects
> are not quite balanced. There is also a lot of clean up which IMO belongs
> to the AppTerminate method.

What code?

> Wouldn't it be better to create and initialize the interface object in the
> application.Initialize and To destroy it in the Application.Terminate?
> Then moving between Create doesn't matter anymore.
> The interfaces unit must then set a class for the interface, like:
> type
>   LCLWidgetInterface = class of InterfaceBase;
> initialize
>   LCLWidgetInterface = TGTKObject;
> In the Application.Initialize code like this could be used:
>   InterfaceObject := LCLWidgetClass.Create;

Application.Initialize is called at the start of the program _after_ all
initialization sections. Units like synedit need the interface object in
their initialization section. So, we must create the interface object in one
of the initialization sections of the LCL. The only choices we have here is
gtk/interfaces.pp or gtk/gtkint.pp. They are the topmost units of the


More information about the Lazarus mailing list