I want to be able to tell if the user holds the mouse button down on a command button used to scroll through recordset records, and if so, start scrolling automatically in the direction indicated. [sig][/sig]
Use This piece of code. Place a Command Button named 'Command1' and a Timer named 'Timer1'. Set the Enabled property to True and set the Interval property to ( 1000 / (Number of ticks/sec) ).
You can add some other nice features (e.g. waiting for a specified time before begingin tick.)
Another possible feature is to raise Command1's Click event by placing
Command1.Value = True.
Here is the code:
Dim boolIsDown As Boolean
Private Sub Command1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Debug.Print "Down"
If Button = vbLeftButton Then
Timer1.Enabled = True
End If
End Sub
Private Sub Command1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Debug.Print "Up"
If Button = vbLeftButton Then
Timer1.Enabled = False
End If
End Sub
Private Sub Timer1_Timer()
Beep
' Command1.Value = True ' Optional
End Sub [sig]<p>Mohammad Mehran Nikoo<br><a href=mailto:mohmehran@yahoo.com>mohmehran@yahoo.com</a><br>MCP with experience in VB, ASP, XML, SQL, COM[/sig]
Thanks... I'm familiar with the timer control, etc. It was the button _mousedown() and _mouseup() events I wasn't familiar with - I should be able to get it to work now. [sig][/sig]
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.