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

# TCustomComboBox.MatchListItem

Gets the position for the specified value in Items using the AutoCompleteText settings for the control.

## Declaration

Source position: stdctrls.pp line 412

`public function TCustomComboBox.MatchListItem(`
`const AValue: TCaption`
`):Integer;`

## Arguments

`AValue` |  | Value to locate in the Items for the control.

## Function result

Ordinal position in Items for the specified value, or -1 when not found.

## Description

MatchListItem is an Integer function used to get the ordinal position in Items where the value in AValue is stored.

MatchListItem uses the TComboBoxAutoCompleteText settings in AutoCompleteText to locate the position for the specified value. If cbactSearchCaseSensitive is included in AutoCompleteText, a case-sensitive search is used to locate the value. Otherwise, AValue is converted to uppercase and a case-insensitive search is performed in Items.

The search direction in Items is determined using the cbactSearchAscending value in AutoCompleteText. When present, the search starts at the first value in Items (position 0) and continues until a match is found or all Items have been checked. When omitted, the search starts at the last value in Items (Count-1) and continues until a match is found or all Items have been checked.

The return value is -1 if Items does not contain any entries (Count=0), if AValue is an empty string (''), or AValue is not found in Items using the AutoCompleteText settings.

MatchListItem is called from the RealSetText method when the edit text for the control has been changed.

## Version info

Added in LCL version 3.0.

## See also

TCustomComboBox.RealSetText |  | Updates ItemIndex when the new value for the control is updated.
TCustomComboBox.Items |  | The list of items displayed in the combo-box control.
TCustomComboBox.AutoCompleteText |  | Options for the behavior of the Auto-Complete feature.