Unit 'Classes' Package
[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] [#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 2458

type TComponent = class(TPersistent,IUnknown,IInterfaceComponentReference)

protected

  procedure Notification(); virtual;

  

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

public

type

  TToStringNameMode = (

  snmNameClassName,

  snmClassName,

  snmName

);

public

  ToStringNameMode: TToStringNameMode;

  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.

  property ComObject: IUnknown; [r]

  

Interface reference implemented by the component.

  function IsImplementorOf();

  

Checks if the current component is the implementor of the interface.

  procedure ReferenceInterface();

  

Interface implementation of Notification.

  function ToString; override;

  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.

  property Observers: TObservers; [r]

  property OnGetDeltaStreams: TGetDeltaStreamsEvent; [rw]

published

  property Name: TComponentName; [rws]

  

Name of the component.

  property Tag: PtrInt; [rw]

  

Tag value of the component.

end;

Inheritance

TComponent

  

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

|

TPersistent,IUnknown,IInterfaceComponentReference

  

Base class for streaming system and persistent properties.

|

TObject,IFPObserved

  

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 altogether 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.


Documentation generated on: Dec 22 2024