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

# TCustomComboBox.AddHistoryItem

Add an item as the first entry in the history list for the control.

## Declaration

Source position: stdctrls.pp line 413

`public procedure TCustomComboBox.AddHistoryItem(`
`const Item: string;`
`MaxHistoryCount: Integer;`
`SetAsText: Boolean;`
`CaseSensitive: Boolean`
`); procedure TCustomComboBox.AddHistoryItem(`
`const Item: string;`
`AnObject: TObject;`
`MaxHistoryCount: Integer;`
`SetAsText: Boolean;`
`CaseSensitive: Boolean`
`);`

## Arguments

`Item` |  | The string to be added to the list.
`MaxHistoryCount` |  | The maximum number of items that can be added to the history.
`SetAsText` |  | When True the string also is copied into the edit box for the control.
`CaseSensitive` |  | True means that the list can contain multiple items with the same text, differing in case.

## Arguments

`Item` |  | The string to be added to the list.
`AnObject` |  | The object associated with the item; can be Nil.
`MaxHistoryCount` |  | The maximum number of items that can be added to the history.
`SetAsText` |  | When True the string also is copied into the edit box for the control.
`CaseSensitive` |  | True means that the list can contain multiple items with the same text, differing in case.

## Description

AddHistoryItem is a procedure used to add the values in Item and AnObject to the beginning of the list items displayed for the control. AddHistoryItem uses the value in CaseSensitive to determine if case is significant when comparing the value in Item to the existing value at the beginning of Items.

AddHistoryItem calls the InsertObject method in Items to store the values at the initial position in the Items list (ordinal position 0). When Item exists at another position in Items, it is removed.

MaxHistoryCount contains the maximum number of entries allowed in the Items property. When the number of entries in Items exceeds the value in MaxHistoryCount, the excess is removed from the end of the Items property.

When SetText is True, the value in Item is stored to the Text property.

## See also

TCustomComboBox.Items |  | The list of items displayed in the combo-box control.
TCustomComboBox.Text |  | The value in the edit box for the control.
TStrings.InsertObject
TStrings.Delete