Results 1 to 5 of 5

Thread: Right Click

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 2000
    Posts
    93
    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.

  2. #2
    Guest
    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]

  3. #3
    Guest
    Take a look at this thread.

  4. #4
    Hyperactive Member vbzero's Avatar
    Join Date
    Aug 2000
    Location
    Vienna
    Posts
    347

    Arrow

    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 -

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Oct 2000
    Posts
    93
    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
  •  



Click Here to Expand Forum to Full Width