
TreeView Control and Node Click
On 24 Jan 1997 11:21:37 GMT, "Kevin Bowdler"
Quote:
>Does anyone have a way to right click on a node and select it, So a popup
>menu could be displayed
Here's an excerpt from a piece of code I wrote some time back:
Private Sub TreeView1_MouseDown(Button As Integer, _
Shift As Integer,_
X As Single, _
Y As Single)
Select Case Button
Case vbLeftButton
'....stmts for left click
Case vbRightButton
Call RightClick(X, Y)
Case Else
End Select
End Sub
Private Sub RightClick(ByVal X As Single, _
ByVal Y As Single)
Dim nodx As Node
Set nodx = TreeView1.HitTest(X, Y)
If Not nodx Is Nothing Then
nodx.Selected = True
TreeView1.SelectedItem = nodx
End If
If Not (nodx Is TreeView1.SelectedItem.Root) Then PopupMenu
mnuNodes
Set nodx = Nothing
End Sub
Jeff