|
-
Apr 23rd, 2000, 06:35 AM
#1
Thread Starter
Lively Member
Hello all! Just looking for simple code that will let me discern whether the user used the left or right mouse button (or middle for that matter) in a WHATEVERNODE_NodeClick() event. You would think Microsoft would just add a button reference like there is in the mousedown event, but WHY MAKE THINGS EASY! 
Thanks to whoever answers.
-
Apr 23rd, 2000, 07:44 AM
#2
Use MouseDown event
Node click doesn't care what button you clicked with. What you can do is to use a MouseDown event to check if the user clicked with the right mouse button.
Code:
Private Sub TreeView1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
Dim nodCurrent As Node
If Button = vbRightButton Then
Set nodCurrent = TreeView1.HitTest(x, y)
If Not nodCurrent Is Nothing Then
nodCurrent.Selected = True
MsgBox "You right clicked on " & nodCurrent.Text
End If
End If
End Sub
-
Apr 23rd, 2000, 03:22 PM
#3
transcendental analytic
I remember this pattern. You can use this one, it fires only if you click on a node.
Code:
Private Sub TreeView1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
TreeView1.Tag = Button
End Sub
Private Sub TreeView1_NodeClick(ByVal Node As ComctlLib.Node)
Select Case TreeView1.Tag
Case 1
'Left button code here
Case 2
'Right button code here
End Select
End Sub
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|