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

# TListItems.IndexOf

Gets the ordinal position in the container for the specified list item.

## Declaration

Source position: comctrls.pp line 1182

`public function TListItems.IndexOf(`
`const AItem: TListItem`
`):Integer;`

## Arguments

`AItem` |  | TListItem instance to locate in the container.

## Function result

Ordinal position in the container for the specified list item, or -1 when not found.

## Description

If the container has cached items, the cache index for the list item in AItem is used as the return value. If a cached entry is not already assigned, the IndexOf method in the internal storage is called locate the specified list item.

The return value is -1 if the specified list item is not found in the container.

The list item and its position in the list are stored in the internal cache for subsequent use in the container.