CxGrpTree Methods
The CxGrpTree object contains the following methods:
AboutBox
The AboutBox method displays an About dialog box for the control.
Syntax
AboutBox()
Example
The following examples launch an About dialog box for the control.
Sub ShowAboutBox()
<Object>.AboutBox
End Sub
Sub ButtonTool_EventClick()
Dim This : Set This = ButtonTool
<Object>.AboutBox
End Sub
Collapse
The Collapse method collapse the current node.
Syntax
Collapse(CollapseChildren As Boolean)
Parameters
| Parameter | Required | Description |
|---|---|---|
|
CollapseChildren |
Yes |
Indicates whether all child nodes are to be collapsed. |
Example
The following method collapses the selected node when the corresponding context menu item is selected. This example is taken from the CxGrpTree Example.
Sub CxGrpTree_EventContextMenu(EventID)
Dim This : Set This = CxGrpTree
If EventID = "EVENT_EXPAND" Then
CxGrpTree.Expand False
Elseif EventID = "EVENT_COLLAPSE" Then
CxGrpTree.Collapse False
Elseif EventID = "EVENT_REFRESH" Then
CxGrpTree.Refresh
End If
End Sub
Expand
The Expand method expands the current node.
Syntax
Expand(ExpandChildren As Boolean)
Parameters
| Parameter | Required | Description |
|---|---|---|
|
ExpandChildren |
Yes |
Indicates whether all child nodes are to be expanded. |
Example
The following method expands the selected node when the corresponding context menu item is selected. This example is taken from the CxGrpTree Example.
Sub CxGrpTree_EventContextMenu(EventID)
Dim This : Set This = CxGrpTree
If EventID = "EVENT_EXPAND" Then
CxGrpTree.Expand False
Elseif EventID = "EVENT_COLLAPSE" Then
CxGrpTree.Collapse False
Elseif EventID = "EVENT_REFRESH" Then
CxGrpTree.Refresh
End If
End Sub
GetSelectedNodeAttrValue
The GetSelectedNodeAttrValue method returns the attribute value of the selected node for the specified level. The AttributeId parameter can be a string or a number.
Syntax
GetSelectedNodeAttrValue(AttributeId As Variant) As String
Parameters
| Parameter | Required | Description |
|---|---|---|
|
AttributeId |
Yes |
Identifies the node attribute to return. For a list of possible values for this parameter, see Node Attributes. |
Example
The following example displays attributes of the selected node. This example is taken from the CxGrpTree Example.
Sub CxGrpTree_EventOnSelChange()
Dim This : Set This = CxGrpTree
Dim strMsg
strMsg = "Details for node " + CxGrpTree.GetSelectedNodeAttrValue("~nodeid")
strMsg = strMsg + vbCrlf + vbCrlf
strMsg = strMsg + "Description: " + CxGrpTree.GetSelectedNodeAttrValue("~desc")
strMsg = strMsg + vbCrlf
strMsg = strMsg + "Category: " + CxGrpTree.GetSelectedNodeAttrValue("~cat")
strMsg = strMsg + vbCrlf
strMsg = strMsg + "Type: " + CxGrpTree.GetSelectedNodeAttrValue("~type")
strMsg = strMsg + vbCrlf
strMsg = strMsg + "# of Children: " + CStr(CxGrpTree.GetSelectedNodeChildCount())
eboDetails.Text = strMsg
End Sub
GetSelectedNodeChildCount
The GetSelectedNodeChildCount method returns the number of children for the selected node.
Syntax
GetSelectedNodeChildCount() As Long
Example
The following example displays the number of child nodes attached to the selected node. This example is taken from the CxGrpTree Example.
Sub CxGrpTree_EventOnSelChange()
Dim This : Set This = CxGrpTree
Dim strMsg
strMsg = "Details for node " + CxGrpTree.GetSelectedNodeAttrValue("~nodeid")
strMsg = strMsg + vbCrlf + vbCrlf
strMsg = strMsg + "Description: " + CxGrpTree.GetSelectedNodeAttrValue("~desc")
strMsg = strMsg + vbCrlf
strMsg = strMsg + "Category: " + CxGrpTree.GetSelectedNodeAttrValue("~cat")
strMsg = strMsg + vbCrlf
strMsg = strMsg + "Type: " + CxGrpTree.GetSelectedNodeAttrValue("~type")
strMsg = strMsg + vbCrlf
strMsg = strMsg + "# of Children: " + CStr(CxGrpTree.GetSelectedNodeChildCount())
eboDetails.Text = strMsg
End Sub
JumpToChild
The JumptoChild method sets the target node to a child of the current node that matches the criteria.
Syntax
JumpToChild(Criteria As String) As Boolean
Parameters
| Parameter | Required | Description |
|---|---|---|
|
Criteria |
Yes |
Filter criteria describing the child node. |
Remarks
For Critera use the form "~criteria=value" (for example, "~desc=California", "~cat=S").
Example
The following example selects the first child node with a description of "Texas."
Sub SelTexas()
GrpTree.JumpToChild "~desc=Texas"
edtMessageBox.Text = "Texas child node selected"
End Sub
Refresh
The Refresh method refreshes the contents of the control from the Current Value Service (CVS).
Syntax
Refresh()
Example
The following example refreshes the Group Tree when the Site.Service is changed. This example is taken from the CxGrpTree Example.
Sub btnSetSiteService_EventClick()
Dim This : Set This = btnSetSiteService
CxGrpTree.SiteService = eboSiteService.Text
CxGrpTree.Refresh
End Sub
SetTargetNode
The SetTargetNode method sets the target node that matches the criteria.
Syntax
SetTargetNode(Criteria As String) As Boolean
Parameters
| Parameter | Required | Description |
|---|---|---|
|
Criteria |
Yes |
Filter criteria describing the target node. |
Remarks
For Critera use the form "~criteria=value". (for example, "~desc=California", "~cat=S")
Example
The following example selects the first node matching eboFindCriteria.Text when btnFindNode is clicked. This example is taken from the CxGrpTree Example.
Sub btnFindNode_EventClick()
Dim This : Set This = btnFindNode
Dim bRet
bRet = CxGrpTree.SetTargetNode(eboFindCriteria.Text)
If Not(bRet) Then
MsgBox "No node found where " + eboFindCriteria.Text
End If
End Sub


