WtTimer Function

Registers a callback function for a given timer.

Usage

status = WtTimer(function, params, [client_data])

Parameters

function:

'Add' — If Add is specified, also provide the following three parameters:

time — A long integer specifying the time interval in milliseconds.

timer — A string containing a timer function name.

client_data — (optional) A variable.

'Remove' — If Remove is specified, also provide the following parameter:

id — The timer ID.

Returned Value

For 'Add':

status — The input source ID, or zero (0) to indicate failure.

For 'Remove':

status — One (1) indicates success; zero (0) indicates failure.

Keywords

Noparams — If nonzero, calls the timer with two parameters: wid (the top-level widget name), and client_data.

Once_only — If present and nonzero, the timer function is called only once.

Discussion

This timer, unlike the XtIntrinsics XtTimeOut function, restarts itself. To stop the timer, use the command:

WtTimer("REMOVE", id)

in the timer callback. The new timer ID is returned in the timer callback parameter timer_id.

If you need to keep a copy of the timer ID in a common block, copy the timer_id parameter of the timer callback routine to your timer ID variable in the COMMON block, as shown in the following example.

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 Widgets (Ww) layer or the VDA Tools when developing GUI applications.

For information on the requirements for writing timer procedures, see "Using the Widget Toolbox" in the PV‑WAVE Application Developer’s Guide.

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

See Also

For detailed information on GUI development, refer to the PV‑WAVE Application Developer’s Guide.

For more information about how to write an application program based on the PV‑WAVE Widget Toolbox, refer to Using the Widget Toolbox in the PV‑WAVE Application Developer’s Guide.