Skip to content

TFPSList.Insert

Insert a new item in the list.

Declaration

Source position: fgl.pp line 87

public 
procedure Insert(Index: Integer; Item: Pointer);

function Insert(Index: Integer) : Pointer;

Description

Insert comes in 2 overloaded version. The version without Item creates a slot for a new item at position Index in the list, and returns a pointer to the new slot. The slot will be of size TFPSList.ItemSize.

The version with Item argument will allocate a slot in the list at position Index and will copy the item pointed to by Item to the slot in the list.

In both cases, Index must be 0-based.

Errors

If Index is invalid, an EListError exception will be raised.

See also

Name Description
TFPSList.Add Add a new item to the list.
TFPSList.Delete Delete an item from the list.
TFPSList.Extract delete an element from the list.