Skip to main content

TcxDBTreeList Class

A data-aware version of the TreeList control.

Declaration

TcxDBTreeList = class(
    TcxCustomDBTreeList
)

Remarks

The TcxDBTreeList control is capable of displaying data from a TDataSet or its descendants in a tree-like structure. The connection between the dataset and the TreeList control is managed via the TcxDBTreeListDataController instance, which can be accessed by using the DataController property. Use the DataController.DataSource property to bind a dataset to the TcxDBTreeList control. This dataset must have the two fields required for building a tree structure. Key field values are used to uniquely identify dataset records. The parent field value for a specific record (node in the tree structure) specifies the key field value for a record (node), which is its parent.

See the following screenshot as an example:

The key field of the dataset is ID and the parent field is PARENTID. As you can see, nodes with key values 2, 3, 4, 6, 7 and 8 are child nodes for the node with key value 1. The PARENTID field value for these nodes is 1. Nodes with keys 14, 24 and 43 are child nodes of the node with key value 3, etc. Some records (nodes) can have a parent field value without a corresponding key field value within the dataset. Such records (nodes) will be displayed at the root level of the tree structure (see the node with ID = 1 in the above screenshot). Read the Self-Referenced Dataset topic for more information.

The key field name for the dataset is specified via the DataController.KeyField and the parent field name is specified via the DataController.ParentField property value.

The TcxDBTreeList control supports many display capabilities:

The TcxDBTreeList control also has advanced styles support. You can customize the control’s look & feel by assigning different styles to the control’s elements or by assigning a style sheet to the whole control. The custom draw feature gives you full control over the TreeList control’s appearance.

See Also