How do I keep my value incrementing by holding down the mouse key?

JimJones

Registered User.
Local time
Today, 16:49
Joined
May 6, 2003
Messages
78
Hi,

I have a simple form, where I have 1 field, that gets converted in two other unbound text fields on the same form. No tables or queries involved here.

I want to add a button that increments textbox1 by .01 as long as I keep the button pressed down, instead of having to click each time.

Can this be done?

Thanks,
Jim
 
i am not sure if there is a better way, but we did it by using a shared variable, on the mouse down event, set this to say "R", then entered a loop that checked to make sure it was set to "R", checked a timer event (so it didn't increment to fast), and in the mouse up event reset the variable to say "S", also had a doevent every 20 loops (or something like that). You have to play with it to get it working the way you want. There maybe a better way, maybe someone else knows.
 
FoFa said:
i am not sure if there is a better way, but we did it by using a shared variable, on the mouse down event, set this to say "R", then entered a loop that checked to make sure it was set to "R", checked a timer event (so it didn't increment to fast), and in the mouse up event reset the variable to say "S", also had a doevent every 20 loops (or something like that). You have to play with it to get it working the way you want. There maybe a better way, maybe someone else knows.

Thanks. until a better way comes along, I'll start investigating the method you prescribed.

Jim
 
If you're clicking a command button, you can set the AutoRepeat property of the command button to Yes, thereby causing the code to run repeatedly as long as the button is clicked down.
 
dcx693 said:
If you're clicking a command button, you can set the AutoRepeat property of the command button to Yes, thereby causing the code to run repeatedly as long as the button is clicked down.

It works well - now if I could get the text box to display the incremented value in 'realtime'.

Thanks for the tip.
Jim
 

Users who are viewing this thread

Back
Top Bottom