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

# TCustomListView.AddItem

Adds a list item with the specified caption and optional object.

## Declaration

Source position: comctrls.pp line 1627

`public procedure TCustomListView.AddItem(`
`Item: string;`
`AObject: TObject`
`);`

## Arguments

`Item` |  | Caption for the new list item.
`AObject` |  | Optional object instance for the list item.

## Description

AddItem is a method used to create and store a new TListItem instance in the Items container. AddItem calls the Add in Items to create the TListItem instance and store it in the list storage for the container.

Item contains the text used as the Caption for the list item. AObject is a object instance derived from TObject, and its address is stored in the Data property for the list item.

## See also

TCustomListView.ItemInserted |  | Performs actions when a list item has been inserted in the Items collection.
TListItems.Add |  | Adds a new list item to the container.
TListItems.AddItem |  | Adds the specified list item to the storage for the container.
TListItem.Caption |  | Caption - the name given to this item on the list.
TListItem.Data |  | Pointer to arbitrary Data associated with the list item.