InsertNode - cWebTreeView
Adds a new node to a TreeView
Type: Procedure
Parameters
| Parameter | Type | Description |
|---|---|---|
| tNode | tWebTreeItem | Node to add to the TreeView |
Syntax
Procedure InsertNode tWebTreeItem tNode
Call Example
Send InsertNode tNode
Description
Send InsertNode to add a new node to a TreeView.
Object oTree is a cWebTreeView
{ WebProperty=True }
Property Integer piNextID 100
// ...
End_Object
Object oAddChildBtn is a cWebButton
Set piColumnSpan to 1
Set piColumnIndex to 1
Set psCaption to "Add Child"
Procedure OnClick
tWebTreeItem TreeNode
Integer iID
String sID sParentID
WebGet psSelectedId of oTree to sParentID
WebGet piNextID of oTree to iID
WebSet piNextID of oTree to (iID + 1)
Move iID to sID
Move sID to TreeNode.sId
Move sParentID to TreeNode.sParentId
Move ("Root " + sID) to TreeNode.sName
Move False to TreeNode.bFolder
Send InsertNode of oTree TreeNode
End_Procedure
End_Object
In the above example, the OnClick event of the button object creates a new tree item in the cWebTreeView object as a child of the currently selected tree item. The web property psSelectedID is retrieved to get the item ID of the currently selected tree item. A custom web property (piNextID) has been created to maintain the next sequential ID to use when creating a new item.