indigoblue
Programmer
I have a treeview which i only want users to select the leaf nodes. The tree consists of a list of headings at the first level, with the leaves on the second level.
To automatically prevent the user selecting the nodes at the heading level, I want some code that automatically selects the first child node under the heading when the heading node is clicked. At the moment, I have the following code:
Private Sub EqualOpTree_Expand(ByVal Node As Object)
' the +/- box has been clicked...
Node.Child.Selected = True
End Sub
Private Sub EqualOpTree_NodeClick(ByVal Node As Object)
' a node has been clicked...
Dim NodeItm
NodeItm = Node.Key
' test to see if the clicked node is a heading...
Dim KeyId
KeyId = Right(NodeItm, 2)
If KeyId = "L1" Then
Node.Child.Selected = True
End If
End Sub
... the Expand event code works fine - when the +/- box is clicked, the node expands & the first child is selected. BUT the NodeClick code doesn't work: the node expands and the child node is temporarily selected, but the selection then passes back the node that was clicked. What I want to know is - why? & does anyone have a solution??
Cheers
Paul
To automatically prevent the user selecting the nodes at the heading level, I want some code that automatically selects the first child node under the heading when the heading node is clicked. At the moment, I have the following code:
Private Sub EqualOpTree_Expand(ByVal Node As Object)
' the +/- box has been clicked...
Node.Child.Selected = True
End Sub
Private Sub EqualOpTree_NodeClick(ByVal Node As Object)
' a node has been clicked...
Dim NodeItm
NodeItm = Node.Key
' test to see if the clicked node is a heading...
Dim KeyId
KeyId = Right(NodeItm, 2)
If KeyId = "L1" Then
Node.Child.Selected = True
End If
End Sub
... the Expand event code works fine - when the +/- box is clicked, the node expands & the first child is selected. BUT the NodeClick code doesn't work: the node expands and the child node is temporarily selected, but the selection then passes back the node that was clicked. What I want to know is - why? & does anyone have a solution??
Cheers
Paul