|
-
Oct 18th, 2000, 06:56 AM
#1
Thread Starter
Lively Member
Could anyone let me know how to get the value of a mouse button that fires an event that does not pass which button it was.
-
Oct 18th, 2000, 07:05 AM
#2
You meaning Click event? In it that isn't possible (except if there's a way in API), but in MouseDown and MouseUp subs you can find Button.
Example: (start a new project and paste following into the code)
Code:
Private Sub Form_MouseDown (Button As Integer, Shift As Integer, X As Integer, Y As Integer)
Select Case Button 'Start a case
Case 0 'Nothing pushed
Exit Sub
Case 1 'Left mouse button pushed
Caption = "You pushed me with left mouse button!"
Case 2 'Right mouse button pushed
Caption = "You pushed me with right mouse
button!"
Case 3 'Both mouse buttons pushed
Caption = "You pushed me with both mouse
buttons!"
End Select
End Sub
Heh, looks like other people were little slower than me 
Hope this helps,
[Edited by MerryVIP on 10-18-2000 at 08:09 AM]
-
Oct 18th, 2000, 07:05 AM
#3
Take a look at this thread.
-
Oct 18th, 2000, 07:06 AM
#4
Hyperactive Member
The values for the mouse buttons are
vbLeftButton (1)
vbRightButton (2)
vbMiddleButton (4)
For example:
Code:
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, _
X As Single, Y As Single)
On Error Resume Next
If Button = vbRightButton Then
MsgBox "Right Button"
ElseIf Button = vbLeftButton Then
MsgBox "Left Button"
End If
End Sub
More about that in the MSDN Online Help - MouseEvent -
-
Oct 18th, 2000, 07:26 AM
#5
Thread Starter
Lively Member
The API call did it, 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
|