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

# TListItems.InsertItem

Inserts the specified list item at the specified position in the internal storage for the container.

## Declaration

Source position: comctrls.pp line 1183

`public procedure TListItems.InsertItem(`
`AItem: TListItem;`
`const AIndex: Integer`
`);`

## Arguments

`AItem` |  | List item inserted into the internal storage for the container.
`AIndex` |  | Ordinal position in the internal storage where the list item is inserted.

## Description

InsertItem is a method used to insert the list item in AItem at the ordinal position in AIndex in the internal storage for the container. Values in AItem and AIndex are also stored in the cached entries for the container.

If an owner (TCustomListView) has been assigned for the container, and its handle is valid, the widgetset class is updated with the content for the inserted list item. This includes the text, images, and checked state for the list item.

The ItemInserted method in the owner is also called to notify the control of the inserted list item. This executes an overridden Insert method (when implemented) and signals the OnInsert event handler for the control.