Application Developer Guide > Using the Widget Toolbox > Adding Timers
  

Adding Timers
A timer (the Xt Intrinsics term is TimeOut) is a procedure that is invoked when a specified time interval has elapsed. This function can be used to add or remove a timer. To register a timer routine for a specified interval, use the WtTimer function in the application with the ADD parameter.
timerid = WtTimer("ADD", interval, timer, [client_data])
The interval parameter specifies the time interval, in milliseconds, until the PV-WAVE procedure timer callback timer is invoked. The WtTimer routine, unlike the Xt TimeOut function, restarts itself when the timer callback procedure is called. To stop the timer, use the following command in the timer callback:
status=WtTimer("REMOVE", timerid)
The application can optionally use the client_data procedure to specify some application-defined data to be passed to the timer callback procedure when the callback is invoked. If client_data is a local variable (defined only in the current procedure), a copy of that variable is created and passed (passed by value). If client_data is a global variable (defined in a Common Block), it is passed by reference.
 
note
Rogue Wave has ported a subset of the Widget Toolbox (Wt) functionality that is available for Motif to Microsoft Windows. Because the Widget Toolbox under Windows is not a complete implementation, we recommend that Windows developers use the PV-WAVE 10.0 Widgets (Ww) layer or the VDA Tools when developing GUI applications.
The form of Widget Toolbox timer procedures is:
PRO TimerProc, widget, client_data, nparams, timerid, time
where:
*widget—The top application shell widget ID.
*client_data—The client_data passed to WtTimer.
*nparams—The number of timer-specific parameters after nparams. (This number is always 2, for timerid and time.)
*timerid—The unique timer ID.
*time—The time interval in milliseconds.
 
note
This timer routine is not related to the TIMER procedure in the User Library.
Example
common timer, tid
.
.
id=WtTimer("ADD", 100, 'TimerCallback', my_data)
 
PRO TimerCallback, wid, client_data, nparams, timer_id, interval
COMMON timer, tid
tid = timer_id
.
.
END

Version 2017.1
Copyright © 2019, Rogue Wave Software, Inc. All Rights Reserved.