From RAD Studio API Documentation
Jump to: navigation, search


property Owner: TComponent read FOwner;


__property TComponent* Owner = {read=FOwner};


Type Visibility Source Unit Parent
property public
System.Classes TComponent


Indicates the component that is responsible for streaming and freeing this component.

Use Owner to find the owner of a component. The Owner of a component is responsible for two things:

The memory for the owned component is freed when its owner's memory is freed. This means that when a form is destroyed, all the components on the form are also destroyed.

The Owner is responsible for loading and saving the published properties of its owned controls.

By default, a form owns all components that are on it. In turn, the form is owned by the application. Thus, when the application shuts down and its memory is freed, the memory for all forms (and all their owned components) is also freed. When a form is loaded into memory, it loads all of the components that are on it.

The owner of a component is determined by the parameter passed to the constructor when the component is created. For components created in the form designer, the form is automatically assigned as the Owner.

Warning: If a component has an Owner other than a form or data module, it will not be saved or loaded with its Owner unless you identify it as a subcomponent. To identify a component as a subcomponent, call the SetSubComponent method.

See Also