Results 1 to 5 of 5

Thread: .PopupMenu

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Apr 2000
    Posts
    70

    Question

    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()

  2. #2
    Fanatic Member Kaverin's Avatar
    Join Date
    Oct 2000
    Posts
    930
    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

  3. #3
    Guest
    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

  4. #4
    Guest
    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?

  5. #5
    Guest
    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
  •  



Click Here to Expand Forum to Full Width