Syntax 1: For TreeView controls
Description
Inserts an item in sorted order, if possible.
Applies to
TreeView controls
Syntax
|
1 |
treeviewname.InsertItemSort ( handleparent, label, pictureindex ) |
|
Argument |
Description |
|---|---|
|
treeviewname |
The TreeView control in which you want to insert and |
|
handleparent |
The handle of the item that will be the inserted item’s |
|
label |
The label by which you want to sort the item as a child |
|
pictureindex |
The picture index for the item you want to sort as a |
Return value
Long.
Returns the handle of the item inserted if it succeeds and -1 if
an error occurs.
Usage
If SortType is anything except Unsorted!, the TreeView is always
in a sorted state and you do not need to use InsertItemSort — you can
use any insert function.
If SortType is Unsorted!, InsertItemSort attempts to insert the
item at the correct place in alphabetic ascending order. If the list is
out of order, it does its best to find the correct place, but results
may be unpredictable.
Examples
This example populates the fourth level of a TreeView
control:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
long ll_lev1, ll_lev2, ll_lev3, ll_lev4 int index tv_list.PictureHeight = 32 tv_list.PictureWidth = 32 ll_lev1 = tv_list.InsertItemLast(0,"Composers",1) ll_lev2 = tv_list.InsertItemLast(ll_lev1,& "Beethoven",2) ll_lev3 = tv_list.InsertItemLast(ll_lev2,& "Symphonies",3) FOR index = 1 to 9 ll_lev4 = tv_list.InsertItemSort(ll_lev3, & "Symphony # " + String(index), 4) NEXT tv_list.ExpandItem(ll_lev3) tv_list.ExpandItem(ll_lev4) |
See also