[Overview][Constants][Types][Classes][Procedures and functions][Index] | Reference for unit 'ComCtrls' (#lcl)

# TListItems

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

Implements a container for list items on a list view control.

## Declaration

Source position: comctrls.pp line 1138

`type TListItems = class(TPersistent)`
`protected`
`procedure DefineProperties(); override;` |  | Defines read and write routines used for binary Data in the list items for the container.
`function GetCount; virtual;` |  | Gets the value for the Count property.
`function GetItem(); virtual;` |  | Gets the value for the indexed Item property.
`function GetOwner; override;` |  | Gets the value for the Owner property.
`procedure WSCreateItems;` |  | Creates list items in the widgetset class, and cache entries for the values.
`procedure DoFinalizeWnd;` |  | Updates flags in the class instance when the widgetset handle is freed.
`procedure SetCount(); virtual;` |  | Sets the value for the Count property.
`procedure SetItem();` |  | Set the value in the indexed Item property.
`procedure ClearSelection;` |  | Clears the selected state for all TListItem instances in the container.
`procedure SelectAll;` |  | Sets the selected state to True for all TListItem instances in the container.
`public`
`function Add;` |  | Adds a new list item to the container.
`procedure AddItem();` |  | Adds the specified list item to the storage for the container.
`procedure BeginUpdate;` |  | Starts an update process for the container and its list view control.
`procedure Clear; virtual;` |  | Removes all list item instances stored in the container.
`constructor Create();` |  | Constructor for the class instance.
`destructor Destroy; override;` |  | Destructor for the class instance.
`procedure Delete();` |  | Removes the list item specified in AIndex from the container.
`procedure EndUpdate;` |  | Ends an update process for the container and its list view control.
`procedure Exchange();` |  | Exchanges the positions for the specified list items in the container.
`procedure Move();` |  | Moves the list item at the specified position to a new position in the container.
`function FindCaption();` |  | Locates a list item with the specified caption starting at given position in the container.
`function FindData();` |  | Locates the list item which has the specified values in its Data property.
`function GetEnumerator;` |  | Gets an enumerator for the list items in the container.
`function IndexOf();` |  | Gets the ordinal position in the container for the specified list item.
`function Insert();` |  | Creates and inserts a list item at the specified ordinal position in the container.
`procedure InsertItem();` |  | Inserts the specified list item at the specified position in the internal storage for the container.
`property Flags: TListItemsFlags; [r]` |  | Contains the flag values currently assigned to the list.
`property Count: Integer; [rw]` |  | The number of TListItem instances stored in the container.
`property Item []: TListItem; default; [rw]` |  | Provides indexed access to the TListItem instance in the container by their ordinal position.
`property Owner: TCustomListView; [r]` |  | List view control that is the owner of the container and its list items.
`end;`

## Inheritance

`TListItems` |  | Implements a container for list items on a list view control.
`TPersistent`
?
`TObject`

## Description

TListItems is a TPersistent descendant which implements the container used to store TListItem instances used in a TCustomListView control. The Owner of the container is the TCustomListView control passed as an argument to the constructor.

TListItems is the type used to implement the Items property in TCustomListView.

TListItems provides properties and methods needed to maintain and access the TListItem instances stored in the list for the container. Item is the default property for the class instance and allows access to the list items by their ordinal position in the container. It also the target for an enumerator using the TListItemsEnumerator supported in the class instance.

TListitems has a built-in cache for the last accessed item. This will speed up interface updates since Item.Index is often used for the same item updating more properties. If FCacheIndex contains -1 then the cache is not valid.

## See also

TCustomListView.Items |  | Collection of list items displayed on the list view control.
TListItem |  | Represents the items created in TCustomListView and descendants.
TListItemsEnumerator |  | Implements an enumerator for TListItem values in a TListItems container.