TTreeNode.DefaultTreeViewSort function
Default routine used to returns a numeric value with the sort order for the specified tree nodes.
Declaration
function DefaultTreeViewSort(Node1: TTreeNode; Node2: TTreeNode)
: IntegerArguments
Node1 | Tree node compared in the method. |
Node2 | Tree node compared in the method. |
Function result
Numeric value with the relative sort order for the compared nodes.
Description
DefaultTreeViewSort is the default routine used to compare tree
nodes to determine their sort order. DefaultTreeViewSort is used in the
CustomSort method when a another comparison routine has not been specified in
the argument for the method. It is passed as an argument to the Sort routine
in the implementation section for the unit.
DefaultTreeViewSort checks for an assigned OnCompare event handler in the TreeView control for the nodes. When assigned, it is signalled to compare the specified nodes to determine the return value for the method. If TreeView or its OnCompare handler have not been assigned, the text for the nodes in Node1 and Node2 are compared to get the return value. The return values contains the following:
- < 0
- Node1.Text occurs before Node2.Text in the sort order.
- 0
- Node1.Text and Node2.Text have the same value in the sort order.
- > 0
- Node1.Text occurs after Node2.Text in the sort order.
On UNIX-like platforms, the CompareStr routine is called to compare the values for the Text in the nodes. The comparison is case-sensitive. All other platforms call the AnsiCompareStr routine to compare the Text values. AnsiCompareStr handles ANSI characters which include accented characters. The comparison is case-sensitive.
See also
An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
