Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Datatree question

Status
Not open for further replies.

sayan

ISP
Feb 13, 2002
11
0
0
TH
Hi. How can I detect a right button click on a datatree node? Is there any function that will be called when this happens? Is there a Mouse_Up event for a datatree node or something? Because I need to call up a popup menu when I press the right button on top of a datatree node. This menu would be different according to the node in question, but I can't find a way to detect if a Node_Click was with the right or left button.
Any help is appreciated.
 
This is one way to solve it:

Private tvwButton As Integer

Private Sub TreeView1_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
tvwButton = Button
End Sub

Private Sub TreeView1_NodeClick(ByVal Node As ComctlLib.Node)
If tvwButton = vbRightButton Then MsgBox "You've rightclicked this node"
End Sub


Another way would be using API, but I can't remember any tutorials right now...

LuCkY
 
Try like this.Then using Menu Editor create mnuPopup

Private Sub TreeView1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)

If Button = vbRightButton Then

PopupMenu mnuPopup

End If

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top