Topic Path: Symbol Reference > Functions > CompareItems Function
CompareItems Function

Compares DNS tree nodes for sorting purposes.

function CompareItems(
    Item1: TObject; 
    Item2: TObject
): Integer;
DNS Tree node to be use for sorting.
DNS Tree node to be use for sorting. 

Integer - Indicate the relative position of Item1 in the sorted list.

CompareItems is an Integer function used to compare the TIdDNTreeNode instances in Item1 and Item2 for the purpose of determining their ordinal position in a sorted list of DNS tree nodes. 

CompareItems casts both Item1 and Item2 to TIdDNSTreeNode object instances to access their CLabel properties used in the text comparision. CompareItems comparision are performed without case sensitivity, and is not affected by the current system locale. 

The return value indicates where the tree nodes appear in the sorted list based on their CLabel value, and use the following values and meanings: 


Item1 and Item2 contain the same CLabel value. 
Item1 is less than Items2. 
Item1 is greater that Item2. 


CompareItems is the utility passed an an argument to the BubbleSort method following a call to TIdDNTreeNode.SortChildren.

Copyright 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved.
Post feedback to the Indy Docs Newsgroup.