Loop when holding down left mouse button

Hi

I am new to Xojo and need some help.

For example, let’s say I have a button to increment a number. When I click and hold the left mouse button down when over the button I would like run a loop to increment the number. When I release the left mouse button the number will stop incrementing.

This is a desktop program running in Windows, but I would also want to run it on a Mac later.

Could anyone give me a few tips.

Drag a Timer to the window and set it’s time to the speed you want this number to increment. With the Button add a MouseDown event to start the timer ( mytimer.mode = timer.modemultiple ) and a MouseUp to stop the timer.

Sample project: http://timi.me/.misc/looperoo.zip

The UpDownArrows control does exactly what you want - as long as the arrow is pressed the up or down event will keep on firing.

Thanks all for the help. Tim, the timer routine worked fine, especially as the routine that I actually wanted to do did need to be speed adjustable, so it was the perfect solution.