Simulating a wheel

flipper
09-20-2000, 09:33 PM
Can somebody help me ? I have a progressBar and I want this bar to "progress" when I press a button UNTIL I release that button. How can I code this ??

BillSoo
09-20-2000, 10:46 PM
Check the mousedown and mouseup events.

One example:

Put the code to increment the progressbar in a timer event.
disable the timer
in the mouse down event, enable the timer
in the mouseup event, disable the timer

This is fairly simple which is why I suggest it. In my own code though, I tend to avoid timers where possible since they are a fixed resource and I don't want to use too many.

"I have a plan so cunning you could put a tail on it and call it a weasel!" - Edmund Blackadder

neon
09-21-2000, 04:10 AM
BillSoo i better not catch you dishing timers...

they do come in useful sometimes...

- neon

I like Pizza.

BillSoo
09-21-2000, 05:23 AM
I agree that timers come in useful at times. The problem is that they can be *too* useful and wind up getting put on every form. Sometimes even multiple timers per form. Before you know it, you've run out of timers. And remember, the timer limit is for all of windows. So if your application is hogging all the timers, other applications can't run.

Timers are like global variables and the GOTO statement, best used sparingly...

"I have a plan so cunning you could put a tail on it and call it a weasel!" - Edmund Blackadder

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum