RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TObjectList.Items Property

Lists the object references.

Pascal
property Items [Index: Integer]: TObject;
C++
__property TObject * Items[int Index];

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 forth. 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:
Note: ObjectList1.Items[i] := Form1.FindChildControl(ListBox1.Items[i]);
Note: ObjectList1[i] := Form1.FindChildControl(ListBox1.Items[i]);
 

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!