System.Contnrs.TObjectList.Items

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

property Items[Index: Integer]: TObject read GetItem write SetItem; default;

C++

__property System::TObject* Items[int Index] = {read=GetItem, write=SetItem/*, default*/};

Properties

Type Visibility Source Unit Parent
property public
System.Contnrs.pas
System.Contnrs.hpp
System.Contnrs TObjectList

Description

Lists the object references.

Use Items to access objects in the list. Items is a zero-based array: the first object is indexed as 0, the second object is indexed as 1, and so on. You can read or change the value at a specific index, or use Items with the Count property to iterate through the list.

If OwnsObjects is true, reassigning an Items index frees the object that previously occupied that position in the list.

Items can contain nil (Delphi) or NULL (C++) references. To remove nil (Delphi) or NULL (C++) references and reduce the size of the array, call the Pack method.

Note: In Delphi, Items is the default property of TObjectList. This means you can omit the property name. Thus, the following two lines of code are both acceptable and do the same thing:

ObjectList1.Items[i] := Form1.FindChildControl(ListBox1.Items[i]);

ObjectList1[i] := Form1.FindChildControl(ListBox1.Items[i]);

See Also