SortAll PowerScript function
Description
Sorts all the levels below an item in the TreeView item hierarchy.
Controls
TreeView controls
Syntax
1 |
<span>treeviewname</span><span>.SortAll</span> ( <span>itemhandle</span>, <span>sorttype</span> ) |
Argument |
Description |
---|---|
treeviewname |
The TreeView control in which you want |
itemhandle |
The item for which you want to sort all |
sorttype |
The sort method you want to use. Values
|
Return Values
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 |
long ll_tvi |
1 |
1 |
//Find the current treeitem |
1 |
ll_tvi = tv_list.FindItem(CurrentTreeItem! , 0) |
1 |
1 |
//Sort all children |
1 |
tv_list.<span>SortAll</span>(ll_tvi , Ascending!) |
This example recursively sorts the entire TreeView
control:
1 |
long ll_tvi |
1 |
1 |
//Find the root treeitem |
1 |
ll_tvi = tv_list.FindItem(RootTreeItem! , 0) |
1 |
1 |
//Sort all children |
1 |
tv_list.<span>SortAll</span>(ll_tvi , Ascending!) |