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

TCollectionItem

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

Basic object that is managed by a TCollection class.

Declaration

Source position: classesh.inc line 430

type TCollectionItem = class(TPersistent)

protected

  procedure SetCollection(); virtual;

  procedure Changed();

  

Method to notify the managing collection that the name or index of this item has changed.

  function GetOwner; override;

  

Returns the managing collection.

  function GetDisplayName; virtual;

  

Returns the TCollectionItem.DisplayName of the collectionitem

  procedure SetIndex(); virtual;

  

Write method for the TCollectionItem.Index property.

  procedure SetDisplayName(); virtual;

  

Write method for the TCollectionItem.DisplayName property

  property UpdateCount: Integer; [r]

public

  constructor Create(); virtual;

  

Creates a new instance of this collection item.

  destructor Destroy; override;

  

Destroyes this collection item.

  function GetNamePath; override;

  

Returns the namepath of this collection item.

  property Collection: TCollection; [rw]

  

Pointer to the collection managing this item.

  property ID: Integer; [r]

  

Initial index of this item.

  property Index: Integer; [rw]

  

Index of the item in its managing collection TCollection.Items property.

  property DisplayName: String; [rw]

  

Name of the item, displayed in the object inspector.

end;

Inheritance

TCollectionItem

  

Basic object that is managed by a TCollection class.

|

TPersistent

  

Base class for streaming system and persistent properties.

|

TObject

  

Base class of all classes.

Description

TCollectionItem and TCollection form a pair of base classes that manage a collection of named objects. The TCollectionItem is the named object that is managed, it represents one item in the collection. An item in the collection is represented by three properties: TCollectionItem.DisplayName, TCollection.Index and TCollectionItem.ID.

A TCollectionItem object is never created directly. To manage a set of named items, it is necessary to make a descendent of TCollectionItem to which needed properties and methods are added. This descendant can then be managed with a TCollection class. The managing collection will create and destroy it's items by itself, it should therefore never be necessary to create TCollectionItem descendents manually.

See also

TCollection

  

Base class to manage collections of named objects.

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