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

# TListItems.Item

Provides indexed access to the TListItem instance in the container by their ordinal position.

## Declaration

Source position: comctrls.pp line 1187

`public property TListItems.Item[AIndex: Integer] : TListItem read GetItem write SetItem; default;`

## Description

Item is an indexed TListItem property which allows access to the list items in the container by their ordinal position. AIndex specified the TListItem instance returned as the property value, and must be in the range 0..Count-1.

Item is also the default property for the class instance and the target for an enumerator.

Reading a property value causes the list item cache for the container to be checked. If the cached item has the index value in AIndex, it is used as the property value. Otherwise, the TListItem instance at AIndex is used. The cache is updated with the new list item and its index value.

Writing a new property value causes AIndex to validated. No actions are performed during property assignment if AIndex exceeds Count-1. In addition, no actions are needed when the new property value is the same TListItem instance as the existing property value.

Otherwise, the new list item is stored at the position in AIndex and the cache is updated with the list item and its index value. The widgetset class is notified of the changed values when its handle has been allocated. This includes changes to Caption, ImageIndex, SubItemImages, and Checked properties, as well as internal state flags.