The CxGrpTree object contains the following methods:
The AboutBox method displays an About dialog box for the control.
AboutBox()
Example
The following example displays the CygNet Software About dialog box.
|
Sub AboutBox()
GrpTree.AboutBox
End Sub |
The Collapse method collapse the current node.
Collapse(CollapseChildren As Boolean)
| 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 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 |
The Expand method expands the current node.
Expand(ExpandChildren As Boolean)
| 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 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 |
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.
GetSelectedNodeAttrValue(AttributeId As Variant) As String
| 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 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 |
The GetSelectedNodeChildCount method returns the number of children for the selected node.
GetSelectedNodeChildCount() As Long
Example
The following example displays the number of child nodes attached to the selected node. This example is taken from 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 |
The JumptoChild method sets the target node to a child of the current node that matches the criteria.
JumpToChild(Criteria As String) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
Criteria |
Yes |
Filter criteria describing the child node. |
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 |
The Refresh method refreshes the contents of the control from the Current Value Service (CVS).
Refresh()
Example
The following example refreshes the Group Tree when the Site.Service is changed. This example is taken from CxGrpTree Example.
|
Sub btnSetSiteService_EventClick() Dim This : Set This = btnSetSiteService
CxGrpTree.SiteService = eboSiteService.Text
CxGrpTree.Refresh
End Sub |
The SetTargetNode method sets the target node that matches the criteria.
SetTargetNode(Criteria As String) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
Criteria |
Yes |
Filter criteria describing the target node. |
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 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 |