I have a timer that processes jobs every 5 seconds.
There is a timer event that fires every 5 seconds.
When a new job is added to the queue of jobs, the timer may just be about ready to fire.
This is fine if the job added is not the only job in the queue.
but if it is the only job in the queue then it may be processed almost instantaneously.
I need to ensure that a job is in the queue for at least 5 seconds before it is processed.
How can I ‘restart’ the timer when a new job is added to the queue?
(it’s ok if the next job has to wait 10 seconds or more while jobs are being added.)
http://documentation.xojo.com/index.php/Timer.Reset ? Or
.Mode = Timer.ModeOff
.Mode = Timer.ModeSingle ' or whatever
If it had been any plainer it would have bitten me…
The doc doesn’t say if you should reset the period and mode…
I think you’re saying that If I shut it off and turn it back on again that has the same effect.
I only gave the alternative because it is what I had been doing a while before I discovered .Reset myself
.Reset I think would have been better named Restart, as it does not “reset” anything about the timer other than the amount of time it has been running (or the amount of time left until it fires). So, if you have a timer set to 10 seconds and to fire multiple times, and the timer has been running for 9 seconds when you reset it, nothing changes (period and mode are left alone) except the counter is back to 0 seconds… thus another 10 seconds until the timer fires.
Timer.Reset wil work, or Timer.Enabled = False/True, or turning it off and then back on. None of these things affect the Period.