vcl-cxtl-dot-tcxcustomtreelist-9cbb2a55.md
Allows you to implement a custom node sorting algorithm.
property OnCompare: TcxTreeListNodeCompareEvent read; write;
You can handle the OnCompare event to implement custom sorting algorithms.
Important
If your custom sorting algorithm is not thread-safe, make sure that multi-threaded calculations are disabled for data sort operations in the tree list control.
To disable multi-threading for sort operations in the tree list control, set the OptionsData.MultiThreadedSorting property to bFalse.
The OnCompare event occurs every time the tree list control compares values from two records in the same dataset field.
ANode1 and ANode2 parameters allow you to identify two compared tree list nodes.
To determine the result of a value comparison operation, assign one of the following values to the ACompare parameter within an OnCompare event handler:
-1``ANode1 is less than ANode2``0``ANode1 and ANode2 are equal1``ANode1 is greater than ANode2
Refer to the TcxTreeListNodeCompareEvent procedural type description for detailed information on parameters accessible within an OnCompare event handler.
See Also