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

# TListItems.FindCaption

Locates a list item with the specified caption starting at given position in the container.

## Declaration

Source position: comctrls.pp line 1176

`public function TListItems.FindCaption(`
`StartIndex: Integer;`
`Value: string;`
`Partial: Boolean;`
`Inclusive: Boolean;`
`Wrap: Boolean;`
`PartStart: Boolean = True`
`):TListItem;`

## Arguments

`StartIndex` |  | Position in the container where the search is started.
`Value` |  | Value to locate in the captions for the list items. Case is significant.
`Partial` |  | True when a partial match in the caption value is allowed. False when an exact match is required in the caption value.
`Inclusive` |  | True if StartIndex is included in the search. False if the search starts at the position in the container.
`Wrap` |  | True if the search can wrap to the first list item in the container when a match has not been found prior to the last item in the container.
`PartStart` |  | True if a partial match must start at the beginning of the caption value.

## Description

FindCaption is a TListItem function used to find the first list item in the container which matches the specified search criteria. The return value is the TListItem instance with a Caption that matches the specified Value, or Nil when a match is not found.

No actions are performed in the method, and the return value is Nil, when there are no list items in the container (Count = 0), or StartIndex is not valid.

FindCaption visits the TListItem entries in the container to compare Value to the Caption in the list item. Use Partial and PartStart to indicate if (and how) partial matches are performed. Case is significant in the comparison.

Use FindData to locate a list item which contains the specified binary value in its Data property.

## See also

TListItem |  | Represents the items created in TCustomListView and descendants.