[Overview][Constants][Types][Classes][Procedures and functions][Index] | Reference for unit 'ComCtrls' (#lcl)

# TTreeNode.ConsistencyCheck

Ensures that node references to or from the current tree node are valid and consistent.

## Declaration

Source position: comctrls.pp line 3137

`public procedure TTreeNode.ConsistencyCheck;`

## Description

ConsistencyCheck validates properties in the tree node to ensure that the node is in a valid state for its TTreeNodes container and the TreeView control where the node is displayed.

ConsistencyCheck can raise a catchable debugger exception if any of the values are not consistent or valid. For instance:

- The capacity in Items has a negative value.
- The capacity in Items is smaller than the number of stored child nodes.
- The number of nodes in Items is a negative value.
- Items has been assigned but the capacity is zero (0) or a negative value.
- The Height for the node is a negative value.
- The Top for the node is a negative value.
- The Parent node is assigned, but does contain the current node in its Items container.
- The node has pointers to a previous or next sibling node which does have a complimentary pointer to the node.
- The node has a pointer to a previous or successive node in a multi-selection, but that node does have have the complimentary pointer to the original node.
- The MultiSelected property is enabled for the node, but it does not appear in the multi-selection list for the TreeView control.
- The Selected property is enabled for the node, but MultiSelected is not enabled and the TreeView has multi-selections enabled in its Options.
- Items contains a child node with a Nil (or unassigned) value.
- Items has a child node which does not have the current node as its Parent.
- There are circular references between the current node, its Parent, or its previous or next sibling nodes.
- The first child node has an invalid pointer to a previous sibling node.
- A child node which is not the first child node does not have a pointer to the previous sibling or points to the wrong tree node.
- A child node which is not the last child node does not have a pointer to the previous sibling or points to the wrong tree node.
- A child node which is the last node in Items has an invalid pointer to a next sibling node.
- A child node has an Index value which does not match its actual position in Items.

The ConsistencyCheck method is called recursively for child nodes as well.

These exception represent an extraordinary condition.

ConsistencyCheck is called from the implementation of the ConsistencyCheck method in TTreeNodes, and occurs when the TreeView instance calls its ConsistencyCheck method.

## See also

TTreeNodes.ConsistencyCheck |  | Makes sure all references for nodes in the container are consistent.
TCustomTreeView.ConsistencyCheck |  | Verifies that values are updated and valid for the tree view control.