DelphiVCL.Collection or Collection is a container for CollectionItem objects.
Each Collection holds a group of CollectionItem descendants. The Collection maintains an index of the collection items in its Items array. The Count property contains the number of items in the collection. Use the Add and Delete methods to add items to the collection and delete items from the collection.
Objects descended from Collection can contain objects descended from CollectionItem. Thus, for each Collection descendant, there is a corresponding CollectionItem descendant.
The following table lists some typical descendants of Collection with the corresponding CollectionItem descendant and the component that uses each pair:
Collection Descendant | CollectionItem Descendant | Component |
TBitmapLinks | TBitmapLink | TCustomStyleObject |
TAggregates | TAggregate | TClientDataSet |
TCookieCollection | TCookie | TWebResponse |
TCoolBands | TCoolBand | TCoolBar |
TDBGridColumns | TColumn | TDBGrid |
TDependencies | TDependency | TService |
THeaderSections | THeaderSection | THeaderControl |
TListColumns | TListColumn | TListView |
TParams | TParam | many datasets |
TStatusPanels | TStatusPanel | TStatusBar |
The controls that use Collection and CollectionItem descendants have a published property that holds a collection. (For example, the Panels property of StatusBar holds a StatusPanels.) A standard property editor, referred to generically as the Collection editor, can be invoked from the Object Inspector to edit the items in the collection.
Let’s browse all the properties, methods, and built-in properties of the DelphiVCL.Collection using dir() command:
1 2 3 |
import DelphiVCL dir(DelphiVCL.Collection) |
See the responses in our Windows command prompt:
Check out DelphiVCL which easily allows you to build GUIs for Windows using Python.