Results 1 to 4 of 4

Thread: Is vb stupid or is it me?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 1999
    Location
    ma,usa
    Posts
    485

    Question Is vb stupid or is it me?

    Is vb stupid or is it me?Is vb stupid or is it me? Why aren't these actions interpreted correctly when you click away on the mouse? This is killing me - how do I remedy this!!!

    Code:

    Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Debug.Print "mouse down"
    End Sub

    Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Debug.Print "mouse up"
    End Sub

    It prints this in the debug window:
    mouse down
    mouse up
    mouse up
    mouse down
    mouse up
    mouse up
    mouse down
    mouse up
    mouse up
    mouse down
    mouse up
    mouse up



  2. #2
    Fanatic Member
    Join Date
    Sep 1999
    Location
    Bethel, North Carolina, USA
    Posts
    987
    It appears that VB is stupid, here is a solution however...

    VB Code:
    1. Private IsDown As Boolean
    2.  
    3. Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    4. IsDown = True
    5. Debug.Print "mouse down"
    6. End Sub
    7.  
    8. Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    9. If IsDown = True Then
    10.     Debug.Print "mouse up"
    11.     IsDown = False
    12. End If
    13. End Sub
    {Insert random techno-babble here}

    {Insert quote from some long gone mofo here}

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 1999
    Location
    ma,usa
    Posts
    485
    Thanks for the vote of confidence, however I was hoping for a configuration fix or something. The code does the trick but leads me to another question and the urge to blow off some steam; If I have to write code to validate this procedure that was part of the vb package would I be better off using the API to get the button state which probably works without having to validate it in code? If that is in fact the case will I gain performance by using the API across the board and writing my own procedures?

  4. #4
    PowerPoster
    Join Date
    Jun 2001
    Location
    Trafalgar, IN
    Posts
    4,141
    What you are seeing is normal for a double click of the mouse. I have added a few more debug statements to show what is the normal sequence of events when you click on a picture box.
    VB Code:
    1. Private Sub Picture1_Click()
    2. Debug.Print "Click"
    3. End Sub
    4.  
    5. Private Sub Picture1_DblClick()
    6. Debug.Print "Double Click"
    7. End Sub
    8.  
    9. Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    10. Debug.Print
    11. Debug.Print "Mouse down"
    12. End Sub
    13.  
    14. Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    15. Debug.Print "Mouse Up"
    16. 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