System.Contnrs.TComponentList.Remove

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

function Remove(AComponent: TComponent): Integer; inline;

C++

HIDESBASE int __fastcall Remove(System::Classes::TComponent* AComponent);

Properties

Type Visibility Source Unit Parent
function public
System.Contnrs.pas
System.Contnrs.hpp
System.Contnrs TComponentList

Description

Removes a specified component from the list and (if OwnsObjects is true) frees the component.

Call Remove to delete a specific component from the list when its index is unknown. The value returned is the index of the component in the Items array before it was removed. If the specified component is not found on the list, Remove returns –1. If OwnsObjects is true, Remove frees the component in addition to removing it from the list.

After a component is deleted, all the components that follow it are moved up in index position and Count is decremented. If a component appears more than once on the list, Remove deletes only the first appearance. Hence, if OwnsObjects is true, removing a component that appears more than once results in empty references later in the list.

To use an index position (rather than an object reference) to specify the component to be removed, call Delete.

To remove a component from the list without freeing it, call Extract.

See Also