Patzer
May 9th, 2001, 04:50 AM
Hi,
Maybe a beginners question, but ...
I have a button, that onclick goes to the next record of my form.
My question now is: how can I repeat this, as long as the user holds the button down?
Patzer
have a nice day,
Patzer
Cakkie
May 9th, 2001, 05:17 AM
You can use the MouseDown and MouseUp events of the button. In the mousedown start looping until the mouseup occurs.
Dim ButtonPressed as Boolean
private Sub Command1_MouseDown(Button as Integer, Shift as Integer, X as Single, Y as Single)
ButtonPressed = true
Dim LastSec as integer
Do While ButtonPressed
' this is to foresee a delay
' we dont want the user seeing 500 recs in a second.
If LastSec <> DatePart("s",now) then
if not(rst.eof) then
rst.movenext
end if
LastSec = DatePart("s",now)
end if
' WARNING: YOU MUST USE DOEVENTS IN ORDER to TRAP THE MOUSEUP EVENT!
DoEvents
Loop
End Sub
private Sub Command1_MouseUp(Button as Integer, Shift as Integer, X as Single, Y as Single)
ButtonPressed = false
End Sub
Tom Cannaerts
slisse@planetinternet.be
Programming today is a race between software engineers striving to build bigger and better idot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook