Tree_AddChild (Single Entry) Method
Description
This method adds a child tree item to another child tree item.
A child is a tree item that is connected to a parent or owner tree item.
Parameters
- MyControlReference
- Reference to the control in the form of MyProject_MyForm_MyControl.
- ProjectFile
- String identifying the project as it was passed in LoadProject.
- DialogName
- String identifying the dialog by name.
- ControlName
- String identifying the control by name.
- ParentKey
- String specifying the a unique key in the tree structure identifying the parent tree node.
- Tree Node Handle specifying the tree node uniquely.
- Text
- String specifying the label of the tree node.
- Key
- String specifying the unique key in the tree structure for the new child tree node.
- ImageIndex
- Integer specifying the index of an assigned image in the TreeControl's image list.
- SelectedImageIndex
- Integer specifying the index of an assigned image in the TreeControl's image list.
- ExpandedImageIndex
- Integer specifying the index of an assigned image in the TreeControl's image list.
Return Values
Returns the following according to the situation:
- Tree node handle that is used to identify the
tree item just added. This value is used in later calls to identify which tree item
to modify or query. So for example if you wish to change the text you would pass
the handle pass back by Tree_AddChild into Tree_SetItemText to identify which child tree item
to modify.
- Nil if the dialog is not found, the dialog does not support this function or the parent node is not found.
AutoLISP Syntax
The recommended convention is passing the control identifier directly:
Copy Code |
(Odcl_Tree_AddChild
MyControlReference [as Reference]
ParentKey [as String or Tree Node Handle]
Text [as String]
[Optional] Key [as String]
[Optional] ImageIndex [as Integer]
[Optional] SelectedImageIndex [as Integer]
[Optional] ExpandedImageIndex [as Integer]) |
An alternative convention is to identify the control by providing the project file, the dialog name and the control name:
Copy Code |
(Odcl_Tree_AddChild
ProjectFile [as String]
DialogName [as String]
ControlName [as String]
ParentKey [as String or Tree Node Handle]
Text [as String]
[Optional] Key [as String]
[Optional] ImageIndex [as Integer]
[Optional] SelectedImageIndex [as Integer]
[Optional] ExpandedImageIndex [as Integer]) |
Remarks
Please specify a key when adding tree nodes in order to have expanded images.
Applies For
TreeControl.
Example
Copy Code |
; Populate tree
(Odcl_Tree_AddChild MyProject_MyForm_MyControl
"C_" "Documents and Settings" "C_Documents and Settings" 1 1 3) |
See Also
Tree_AddChild (Using Lists),
Tree_AddParent (Using Lists),
Tree_AddParent (Single Entry),
Tree_Clear,
Tree_DeleteItem,
Tree_InsertAfter,