Sign in Join
FPDoc Onlineexperiment

TListItems.Add function

Member of TListItemspublicIn unit ComCtrls

Adds a new list item to the container.

Declaration

pascal
function Add: TListItem

Function result

The TListItem instance created and stored in the method.

Description

Add is a TListItem function used to create a new list item instance and add it to the container. The return value contains the TListItem instance created in the method, and stored in the internal list for the container.

When a list view control has been assigned to Owner, its CreateListItem method is called to create the new list item. A custom item class can be provided using the OnCreateItemClass event handler in the list view control. Otherwise, TListItem.Create is called to create the list item using the container class instance as the Owner.

Add calls the AddItem method to store the new TListItem instance. The widgetset class is notified of the new cached item when its handle is available. The ItemInserted method in Owner is called to execute an overridden InsertItem method (when available) or signal the OnInsert event handler for the list view control (when assigned).

Use Insert to create a new list item and store it at a specified position in the container.

See also

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