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?
Printable View
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?
I think there are better ways, but this works:
It checks if a MouseUp event had fired before starting the sub again.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
Sunny
[Edited by sunnyl on 10-13-2000 at 04:31 AM]
to synnyl:
thanks a lot, that's exactly what I wanted!