[Overview][Constants][Types][Classes][Procedures and functions][Variables] Reference for unit 'Classes' (#fcl)

TComponent

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Base class for all components that need owner-owned functionality.

Declaration

type TComponent = class(TPersistent)

protected

  FComponentStyle: TComponentStyle;

  

Contains the component's style.

  procedure ChangeName();

  

Actually sets the component name.

  procedure DefineProperties(); override;

  

Defines fake top,left properties for handling in the IDE.

  procedure GetChildren(); dynamic;

  

Must be overridden by descendents to return all child components that must be streamed.

  function GetChildOwner; dynamic;

  

Returns the owner of any children.

  function GetChildParent; dynamic;

  

Returns the parent of any children.

  function GetNamePath; override;

  

Returns the name path of this component.

  function GetOwner; override;

  

Returns the owner of this component.

  procedure Loaded; virtual;

  

Called when the component has finished loading.

  procedure Notification(); virtual;

  

Called by components that are freed and which received a FreeNotification.

  procedure ReadState(); virtual;

  

Read the component's state from a stream.

  procedure SetAncestor();

  

Sets the csAncestor state of the component.

  procedure SetDesigning();

  

Sets the csDesigning state of the component.

  procedure SetName(); virtual;

  

Write handler for Name property.

  procedure SetChildOrder(); dynamic;

  

Determines the order in which children are streamed/created.

  procedure SetParentComponent(); dynamic;

  

Set the parent component.

  procedure Updating; dynamic;

  

Sets the state to csUpdating

  procedure Updated; dynamic;

  

Ends the csUpdating state.

  procedure UpdateRegistry(); dynamic;

  

For compatibilty only.

  procedure ValidateRename(); virtual;

  

Called when a name change must be validated

  procedure ValidateContainer(); dynamic;

  

??

  procedure ValidateInsert(); dynamic;

  

Called when an insert must be validated.

public

  procedure WriteState(); virtual;

  

Writes the component to a stream.

  constructor Create(); virtual;

  

Creates a new instance of the component.

  destructor Destroy; override;

  

Destroys the instance of the component.

  procedure DestroyComponents;

  

Destroy child components.

  procedure Destroying;

  

Called when the component is being destroyed

  function ExecuteAction(); dynamic;

  function FindComponent();

  

Finds and returns the named component in the owned components.

  procedure FreeNotification();

  

Ask the component to notify called when it is being destroyed.

  procedure RemoveFreeNotification();

  procedure FreeOnRelease;

  

Part of the IVCLComObject interface.

  function GetParentComponent; dynamic;

  

Returns the parent component.

  function HasParent; dynamic;

  

Does the component have a parent ?

  procedure InsertComponent();

  

Insert the given component in the list of owned components.

  procedure RemoveComponent();

  

Remove the given component from the list of owned components.

  function SafeCallException(); override;

  

Part of the IVCLComObject Interface.

  function UpdateAction(); dynamic;

  property Components: TComponent; [r]

  

Indexed list (zero-based) of all owned components.

  property ComponentCount: Integer; [r]

  

Count of owned components

  property ComponentIndex: Integer; [rw]

  

Index of component in it's owner's list.

  property ComponentState: TComponentState; [r]

  

Current component's state.

  property ComponentStyle: TComponentStyle; [r]

  

Current component's style.

  property DesignInfo: LongInt; [rw]

  

Information for IDE designer.

  property Owner: TComponent; [r]

  

Owner of this component.

  property VCLComObject: Pointer; [rw]

  

Not implemented.

published

  property Name: TComponentName; [rws]

  

Name of the component.

  property Tag: LongInt; [rw]

  

Tag value of the component.

end;

Inheritance

TComponent

  

Base class for all components that need owner-owned functionality.

|

TPersistent

  

Base class for streaming system and persistent properties.

|

TObject

Description

TComponent is the base class for any set of classes that needs owner-owned functionality, and which needs support for property streaming. All classes that should be handled by an IDE (Integrated Development Environment) must descend from TComponent, as it includes all support for streaming all its published properties.

Components can 'own' other components. TComponent introduces methods for enumerating the child components. It also allows to name the owned components with a unique name. Furthermore, functionality for sending notifications when a component is removed from the list or removed from memory alltogether is also introduced in TComponent

TComponent introduces a form of automatic memory management: When a component is destroyed, all its child components will be destroyed first.