Sign in Join
FPDoc Onlineexperiment

TCustomComboBox.MatchListItem function

Member of TCustomComboBoxpublicIn unit StdCtrls

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

Declaration

pascal
function 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.

Added in LCL version 3.0.

See also

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.