Skip to content

Class: cCollection

Properties | Events | Methods | Index of Classes

Maintains a collection of object handles

Hierarchy

cObject > Array > cCollection

Show full hierarchy and direct subclasses

Library: Common Class Library

Package: cCollection.pkg

Description

This class is obsolete. The classes for which this class stored object handles are all obsolete.

To store any type of collection, developers should use the much more efficient native arrays and structs built into the DataFlex language.

A cCollection is used to maintain a collection of object-handles. It is typically used in objects to maintain a list of its child objects. For example, the cStatusBar uses one to keep track of the embedded cStatusPane objects and the cToolbar uses one to keep track of its embedded cToolbarButton objects.

The collection doesn't actually store the objects as child objects. Rather, it just keeps the object-handle of the objects. As such, the objects that are being pointed to by the object-handles have no direct meaning to the collection.

To add objects-handles into the collection, use DoAppendObject or DoInsertObject. To remove an object-handle, use DoRemoveObject. To determine the number of object-handles in the collection, use CountOfObjects.

Each object-handle in the collection has an index. This index represents the zero-based ordinal position in the collection. For example, the first object-handle added to a collection will have an index of zero, and the second one added will have an index of one, and so on. Given an object-handle, you can determine its index by using IndexFromObject, and from an index, you can determine the object-handle using ObjectFromIndex.

To prevent duplicate object-handles in the collection, use pbAllowDuplicates.

Sample

Object oCollection is a cCollection
    Set pbAllowDuplicates To True
End_Object