{
CustomSort example
This example shows how to use the CustomSort method to order a tree view in case-insensitive alphabetical order (either forward or backward). The application must provide a callback function such as CompareFunc below, which calls the global AnsiStrIComp function to perform the actual comparison.
} 
function CustomSortProc(Node1, Node2: TTreeNode; Data: Integer): Integer; stdcall;
begin
  Result := -AnsiStrIComp(PChar(Node1.Text), PChar(Node2.Text));
end;
This procedure can then be used as a parameter to CustomSort to sort the nodes of the tree view:
TreeView1.CustomSort(@CustomSortProc, 0);
 
