RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TComponentList.Insert Method

Adds a component to the list at a specified position.

Pascal
procedure Insert(Index: Integer; AComponent: TComponent);
C++
__fastcall Insert(int Index, TComponent * AComponent);

Call Insert to add a component at a specified position in the list, shifting the item that previously occupied that position (and all subsequent items) up. Insert increments Count and, if necessary, allocates memory by increasing the value of Capacity. 

The Index parameter is zero-based, so the first position in the list has an index of 0. 

To replace a nil (Delphi) or NULL (C++) reference with a new component without growing the array, set the Items property directly. 

 

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!