Sorts all the levels below an item in the TreeView item hierarchy.
TreeView controls
treeviewname.SortAll ( itemhandle, sorttype )
Argument |
Description |
---|---|
treeviewname |
The TreeView control in which you want to sort the subsequent levels in an item’s hierarchy. |
itemhandle |
The item for which you want to sort all the levels below it. |
sorttype |
The sort method you want to use. Values are:
|
Integer. Returns 1 if it succeeds and -1 if an error occurs.
If you specify UserDefinedSort! as your sorttype, define your sort criteria in the Sort event of the TreeView control.
The SortAll function cannot sort level 1 of a TreeView. However, level 1 is sorted automatically when the TreeView’s SortType property calls for sorting.
This example sorts the subsequent levels recursively under the current TreeView item:
long ll_tvi
//Find the current treeitem
ll_tvi = tv_list.FindItem(CurrentTreeItem! , 0)
//Sort all children
tv_list.SortAll(ll_tvi , Ascending!)
This example recursively sorts the entire TreeView control:
long ll_tvi
//Find the root treeitem
ll_tvi = tv_list.FindItem(RootTreeItem! , 0)
//Sort all children
tv_list.SortAll(ll_tvi , Ascending!)