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

# TListItems.Insert

Creates and inserts a list item at the specified ordinal position in the container.

## Declaration

Source position: comctrls.pp line 1183

`public function TListItems.Insert(`
`const AIndex: Integer`
`):TListItem;`

## Arguments

`AIndex` |  | Ordinal position in the container where the list item is stored.

## Function result

TListItem instance stored in the method.

## Description

Insert is a TListItem function used to insert a new TListItem instance into the container at the ordinal position specified in AIndex.

If the container has an assigned owner (TCustomListView), its CreateListItem method is called to create the new list item. Otherwise, the TListItem is created with the container class instance as the owner of the list item.

Inserts calls the InsertItem method to store the list item at the position specified in AIndex in the internal stage for the container.