ObjectDCL Banner

Tree_AddChild (Using Lists) Method

Description

This method adds one or more child tree item to a other child 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:

  • T when successful.
  • 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:

CopyCode imageCopy Code
(Odcl_Tree_AddChild 
		MyControlReference [as Reference]
		(list 
			(list 
				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]) 
			(list 
				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:

CopyCode imageCopy Code
(Odcl_Tree_AddChild
		ProjectFile [as String]
		DialogName [as String]
		ControlName [as String]
		(list 
			(list 
				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]) 
			(list 
				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 create lists as follows using the list keyword:

(list (list x y ...) (list x y ...) ...)
		

It seems that ObjectARX does not always handle lists created as follows:

'(x y ...) (x y ...) ...  
		

Please specify a key when adding tree nodes in order to have expanded images.

Applies For

TreeControl.

Example

CopyCode imageCopy Code
; Populate tree
(Odcl_Tree_AddChild MyProject_MyForm_MyControl
	(list
		(list "C_" "Documents and Settings" "C_Documents and Settings" 1 1 3) 
		(list "C_" "Program Files" "C_Program Files" ) 
		(list "C_" "Windows" "C_Windows" ) 
		)
	)

See Also

Tree_AddChild (Single Entry), Tree_AddParent (Using Lists), Tree_AddParent (Single Entry), Tree_Clear, Tree_DeleteItem, Tree_InsertAfter