TListItems.Item property
Provides indexed access to the TListItem instance in the container by their ordinal position.
Declaration
property 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. Item is
also the default property for the class instance and the target for the
enumerator returned by the
GetEnumerator method.
AIndex is the ordinal position for the TListItem instance returned
as the property value, and must be in the range
0..Count-1. If AIndex
has a value less than 0 (zero) or greater than Count-1, the value for the
property is
Nil. This behavior is compatible with the TListItems
implementation in Delphi.
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 stored 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 be 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.
Modified in LCL versions after 4.4 to return Nil when the index position for the requested value is less than 0 (zero).
See also
An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
