|
-
Oct 14th, 2000, 12:48 AM
#1
Thread Starter
Lively Member
just a quick one, how do i tell in the on click event if it was a right or left click?
Daniel Rose
VB 5.0 Enterprise.
irc:irc2.dynam.ac
If TheCodeInTheSig() Is Not Lame() Then IDontKnowWhatIs()
-
Oct 14th, 2000, 12:57 AM
#2
Fanatic Member
As far as I know, you can't distinguish the identity of the button in a Click event. You'll have to use either a MouseDown or MouseUp event to capture which button it was.
I'm baaaack...
VB5 Professional Edition, VC++ 6
Using a 1 gHz Thunderbird, 256 mb RAM, 40 gb HD system with Win98se
I feel special because I finally figured out how to loop midis: Post link
I'm a fanatic too 
-
Oct 14th, 2000, 11:24 AM
#3
You could use the GetAsyncKeyState api function to do it.
Code:
Private Declare Function GetAsyncKeyState _
Lib "user32" (ByVal vKey As Long) As Integer
Private Sub Label1_Click()
If GetAsyncKeyState(vbLeftButton) Then Caption = "Left Button"
If GetAsyncKeyState(vbRightButton) Then Caption = "Right Button"
PopupMenu MyPopupmenu
End Sub
-
Oct 14th, 2000, 11:30 AM
#4
Or the mouseup Event:
Code:
Private Sub Label1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
'Code
'Button =
' 1: Left, 2:Right, 4:Middle
End Sub
Matt, why had you posted twice?
-
Oct 14th, 2000, 11:43 AM
#5
1 = Left
2 = Right
3 = Middle
Sometimes that happens. That's what I get for using a Dial-Up Connection .
Someday, I'll get a Cable or DSL or T3 and I will rule the world! Muhahahahahahahaha
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
|