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

TComponent

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

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

Declaration

Source position: classesh.inc line 1576

type TComponent = class(TPersistent, IUnknown, IInterfaceComponentReference)

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 GetOwner; override;

  

Returns the owner of this component.

  procedure Loaded; virtual;

  

Called when the component has finished loading.

  procedure Loading; virtual;

  procedure Notification(); virtual;

  

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

  procedure PaletteCreated; dynamic;

  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 SetDesignInstance();

  procedure SetInline();

  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.

protected

  class procedure UpdateRegistry(); dynamic;

  

For compatibilty only.

protected

  procedure ValidateRename(); virtual;

  

Called when a name change must be validated

  procedure ValidateContainer(); dynamic;

  

??

  procedure ValidateInsert(); dynamic;

  

Called when an insert must be validated.

  function QueryInterface(); virtual;

  function _AddRef;

  function _Release;

  function iicrGetComponent;

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 BeforeDestruction; override;

  

Overrides standard BeforeDestruction.

  procedure DestroyComponents;

  

Destroy child components.

  procedure Destroying;

  

Called when the component is being destroyed

  function ExecuteAction(); dynamic;

  

Standard action execution method.

  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();

  

Remove a component from the Free Notification list.

  procedure FreeOnRelease;

  

Part of the IVCLComObject interface.

  function GetEnumerator;

  

Create an IEnumerator instance

  function GetNamePath; override;

  

Returns the name path of this component.

  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.

  procedure SetSubComponent();

  

Sets the csSubComponent style.

  function UpdateAction(); dynamic;

  

Updates the state of an action.

  function IsImplementorOf();

  

Checks if the current component is the implementor of the interface

  procedure ReferenceInterface();

  

Interface implementation of Notification

  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,IUnknown,IInterfaceComponentReference

  

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

|

TPersistent

  

Base class for streaming system and persistent properties.

|

TObject

  

Base class of all classes.

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.

The latest version of this document can be found at lazarus-ccr.sourceforge.net.