[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] | Reference for unit 'Forms' (#lcl)

# TApplication.Initialize

Initializes the widgetset (and more).

## Declaration

Source position: forms.pp line 1626

`public procedure TApplication.Initialize; override;`

## Description

Initialize is an overridden procedure in TApplication used to perform initialization tasks for the application. Initialize calls the inherited method to provide support for instance counting in the custom application. Initialize ensures that the WidgetSet class type is assigned for the application, and that the Screen singleton is initialized and updated.

Initialize raises an Exception if WidgetSet has not been assigned, or contains a class type other than TWidgetSet, for the application.

Initialize updates the Flags property to include the value AppInitialized when both the LCL interface (Widgetset) and the Screen singleton have been configured.

Initialize loads the graphic image used in the Icon property. If a resource with the name MAINICON is included in the Lazarus Resource, it is loaded and used as the application icon. Otherwise, FindResource is called to locate and load the named icon from the resource handle.

## Errors

Raises an Exception if the WidgetSet class is invalid or not assigned.

## See also

Screen |  | The TScreen singleton for the application.
TApplication.Icon |  | The icon associated with this application.
TApplication.Flags |  | Contains state flags for the application.
WidgetSet |  | Provides access to the widgetset class instance for the platform.
TCustomApplication.Initialize