Sorts rows in a DataWindow control, DataStore, or child DataWindow, or items in a TreeView or ListView control.
For syntax for DataWindows and DataStores, see the Sort method for DataWindows in the section called “Sort” in DataWindow Reference.
Description
Sorts the children of an item in a TreeView control.
Applies to
TreeView controls
Syntax
treeviewname.Sort ( itemhandle , sorttype )
Argument |
Description |
---|---|
treeviewname |
The name of the TreeView control in which you want to sort items. |
itemhandle |
The item for which you want to sort its children. |
sorttype |
The sort method you want to use. Valid values are: Ascending! Descending! UserDefinedSort! |
Return value
Integer.
Returns 1 if it succeeds and -1 if it fails.
Usage
The Sort function only sorts the immediate level beneath the specified item. If you want to sort multiple levels, use SortAll. If you specify UserDefinedSort! as your sorttype, define your sort criteria in the Sort event of the TreeView control. To sort level 1 of a TreeView, set itemhandle to 0.
Examples
This example sorts the children of the current TreeView item:
long ll_tvi ll_tvi = tv_foo.FindItem(CurrentTreeItem! , 0) tv_foo.SetRedraw(false) tv_foo.Sort(ll_tvi , Ascending!) tv_foo.SetRedraw(true)
See also
Description
Sorts items in ListView controls.
Applies to
ListView controls
Syntax
listviewname.Sort ( sorttype {, column } )
Argument |
Description |
---|---|
listviewname |
The ListView in which you want to sort items. |
sorttype |
The method you want to use when you sort the ListView items. Values are: Ascending! Descending! Unsorted! UserDefinedSort! |
column (optional) |
The number of the column by which you wish to sort the ListView items. |
Return value
Integer.
Returns 1 if it succeeds and -1 if it fails.
Usage
The default sort is alphanumeric.
If you do not specify a column to sort, the first column is sorted.
Examples
This example sorts the items in column three of a ListView:
lv_list.SetRedraw(false) lv_list.Sort(Ascending! , 3) lv_list.SetRedraw(true)
See also