Syntax 5: For TreeView controls
Description
Inserts an item at a specific level and order in a TreeView
control.
Applies to
TreeView controls
Syntax
|
1 |
treeviewname.InsertItem ( handleparent, handleafter, label, pictureindex ) |
|
Argument |
Description |
|---|---|
|
treeviewname |
The name of the TreeView control in which you want to |
|
handleparent |
The handle of the item one level above the item you want |
|
handleafter |
The handle of the item on the same level that you will |
|
label |
The label of the item you are inserting. |
|
pictureindex |
The Index of the index of the picture you are adding to |
Return value
Long.
Returns the handle of the inserted item if it succeeds and -1 if
an error occurs.
Usage
Use this syntax to set just the label and picture index. Use the
next syntax if you need to set additional properties for the
item.
If the TreeView’s SortType property is set to a value other than
Unsorted!, the inserted item is sorted with its siblings.
If you are inserting the first child of an item, use
InsertItemLast or InsertItemFirst instead. Those functions do not
require a handleafter value.
Examples
This example inserts a TreeView item that is on the same level as
the current TreeView item. It uses FindItem to get the current item and
its parent, then inserts the new item beneath the parent item:
|
1 2 3 4 |
long ll_tvi, ll_tvparent ll_tvi = tv_list.FindItem(currenttreeitem! , 0) ll_tvparent = tv_list.FindItem(parenttreeitem!,ll_tvi) tv_list.InsertItem(ll_tvparent,ll_tvi,"Hindemith", 2) |
See also