Postponing an action using a Timer

From REALbasicWiki

Jump to: navigation, search

If you have the need to run some code only _after_ a method has finished executing, a Timer might be the solution.

A Timer's Action event runs as a normal application Event, and only in the main thread. All such events get executed one after the other, never synchronuously.

You can therefore "queue" a Timer action from your main thread, and it will not run until your currently handled Event has finished executing.

The timer would be run in One-shot mode (Timer.ModeSingle), with a Period value of 0.

Personal tools
related