Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

TcxCustomTreeList.OnCompare Event

Allows you to implement a custom node sorting algorithm.

#Declaration

Delphi
property OnCompare: TcxTreeListNodeCompareEvent read; write;

#Remarks

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.

#Event Occurrence

The OnCompare event occurs every time the tree list control compares values from two records in the same dataset field.

#Event Parameters

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 equal
1
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