Definition: |
include pGUI.e
Ihandle res = IupTimer(cbfunc func=NULL, integer msecs=0, bool active=true) |
Description: |
Creates a timer which periodically invokes a callback when the time is up.
func: a callback address, usually specified as Icallback("name"). msecs: an interval in miliseconds. active: true (1) or false (0) (predefined as constants in psym.e/syminit). Each timer should be destroyed using IupDestroy. |
Example: | A generally useful example of using a timer to allow any currently active drawing processes to abandon, before starting a new one can be found in demo\rosetta\VoronoiDiagram.exw. While relatively simple, it can make a huge difference to responsiveness (and in that particular case, not crashing). |
Attributes: | |
TIME | The time interval in milliseconds. In Windows the minimum value is 10ms. |
RUN | Starts and stops the timer. Possible values: "YES" or "NO". Returns the current timer state. If you have multiple threads start the timer in the main thread. |
WID | (read-only): Returns the native serial number of the timer. Returns -1 if not running. A timer is mapped only when it is running. |
Callbacks: | |
ACTION_CB |
function action_cb(Ihandle ih) ih: identifier of the element that activated the event. Returns: IUP_CLOSE will be processed. Called every time the defined time interval is reached. To stop the callback from being called simply stop the timer with RUN=NO. Inside the callback the attribute ELAPSEDTIME returns the time elapsed since the timer was started (since 3.15). |