Results 1 to 4 of 4

Thread: Double Click

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 2002
    Location
    Toronto, ON Canada
    Posts
    153

    Double Click

    Is there a way to detect if you click on an object with both mousebuttons, like in minesweep to open all the surrounding spot?

  2. #2
    Frenzied Member cyborg's Avatar
    Join Date
    May 2000
    Location
    Sweden
    Posts
    1,755
    yes, if you use MouseDown or MouseMove, the variable 'Button' is 3 if both buttons are pressed
    Check out the FAQ and do a search before you post.
    My tutorials: Anti-Alias Pixels, Accurate Game Loop, Resource File

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jul 2002
    Location
    Toronto, ON Canada
    Posts
    153
    If that's true, why doesn't the following code ever produce a msgbox?

    Code:
    Private Sub Command1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
        If Button = 3 Then
            MsgBox ""
        End If
    End Sub

  4. #4
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    I testet it, and the mousdown event does not respond to double clicking....but you can make two variable LeftButton and RightButton, and check if both of them are true...

    Something like this....

    VB Code:
    1. Option Explicit
    2.  
    3. Dim leftButton As Boolean
    4. Dim rightButton As Boolean
    5.  
    6.  
    7. Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    8.    
    9.     If Button = 1 Then
    10.         leftButton = True
    11.     ElseIf Button = 2 Then
    12.         rightButton = True
    13.     End If
    14.    
    15.     If leftButton = True And rightButton = True Then
    16.         Text1.Text = True
    17.     End If
    18.    
    19. End Sub
    20.  
    21. Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    22.    
    23.     If Button = 1 Then
    24.         leftButton = False
    25.     ElseIf Button = 2 Then
    26.         rightButton = False
    27.     End If
    28.    
    29.     If leftButton = False Or rightButton = False Then
    30.         Text1.Text = False
    31.     End If
    32.    
    33. End Sub

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