Results 1 to 3 of 3

Thread: mouse: endless mousedown event?

  1. #1

    Thread Starter
    Addicted Member c@lle's Avatar
    Join Date
    Oct 1999
    Location
    Belgium
    Posts
    179
    how can I do the following:
    when a user clicks on a button, I want to repeat my function as long as he holds the button down.

    so how can I check the mouse state at the end of my function?

  2. #2
    Guest
    I think there are better ways, but this works:

    Code:
    Option Explicit
    Dim LettedGo As Boolean
    
    Private Sub Command1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
        LettedGo = False
        Label2.Caption = "Pressed"
        Call mySub
    End Sub
    
    Private Sub Command1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
        LettedGo = True
        Label2.Caption = "Not Pressed"
    End Sub
    
    Private Sub mySub()
        Do Until LettedGo = True
            DoEvents
            'your code
            'as a test i did text1 = text1 & "1"
        Loop
        LettedGo = False
    End Sub
    It checks if a MouseUp event had fired before starting the sub again.

    Sunny

    [Edited by sunnyl on 10-13-2000 at 04:31 AM]

  3. #3

    Thread Starter
    Addicted Member c@lle's Avatar
    Join Date
    Oct 1999
    Location
    Belgium
    Posts
    179

    Thumbs up

    to synnyl:
    thanks a lot, that's exactly what I wanted!

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