SortAll
PowerScript function
Description
Sorts all the levels below an item in the TreeView item
hierarchy.
Applies to
TreeView controls
Syntax
1 |
treeviewname.SortAll ( itemhandle, sorttype ) |
Argument |
Description |
---|---|
treeviewname |
The TreeView control in which you want to sort the |
itemhandle |
The item for which you want to sort all the levels below |
sorttype |
The sort method you want to use. Values are: Ascending! Descending! Unsorted! UserDefinedSort! |
Return value
Integer.
Returns 1 if it succeeds and -1 if an error occurs.
Usage
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.
Examples
This example sorts the subsequent levels recursively under the
current TreeView item:
1 2 3 4 5 6 7 |
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:
1 2 3 4 5 6 7 |
long ll_tvi //Find the root treeitem ll_tvi = tv_list.FindItem(RootTreeItem! , 0) //Sort all children tv_list.SortAll(ll_tvi , Ascending!) |
See also