|
-
Sep 5th, 2001, 06:41 AM
#1
Thread Starter
Hyperactive Member
Check for Right Mouse Button
Can you check if the Right Mouse Button (vbRightButton) has been used on a Label?
I already have a Label1_Click() event for the left button. When I left click on any label1 in my label1 control array an event will occure. How can I triger an event with the right button.
Thanks
-
Sep 5th, 2001, 06:43 AM
#2
In the MouseDown event, put:
If Button = vbRightButton Then
Msgbox "Right Mouse Button Clicked"
End If
-
Sep 5th, 2001, 06:43 AM
#3
VB Code:
Private Sub Label1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If (Button = vbRightButton) Then
'do stuff
End If
End Sub
-
Sep 5th, 2001, 06:53 AM
#4
Thread Starter
Hyperactive Member
Private Sub Label1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single
Using this I get:
Procedure declared does not match discription of event or procedure having the same name.
Is this because of the control array?
-
Sep 5th, 2001, 06:55 AM
#5
yep, use this instead:
VB Code:
Private Sub Label1_MouseUp(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
Select Case Index
Case 1
If (Button = vbRightButton) Then
'do stuff
End If
End Select
End Sub
-
Sep 5th, 2001, 07:04 AM
#6
Thread Starter
Hyperactive Member
Thanks... That works better.
I did change from MouseUP to MouseDown. MouseUP performed both left and right events.
-
Sep 5th, 2001, 07:59 AM
#7
PowerPoster
Originally posted by Mikey
Thanks... That works better.
I did change from MouseUP to MouseDown. MouseUP performed both left and right events.
Hi
Just for future reference... the mouse up and mouse down events will both allow u to check for left and right mouse buttons. There must have been some other error in ur code. Also, MouseUp is the conventional event for things like popup menus.
Regards
Stuart
-
Sep 5th, 2001, 08:09 AM
#8
Thread Starter
Hyperactive Member
I'll keep that in mind... thanks
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
|