PtTimer

A widget that invokes a callback after a given length of time

Class hierarchy:

PtWidgetPtTimer

For more information, see the diagram of the widget hierarchy.

PhAB icon:

PtTimer button in PhAB

Public header:

<photon/PtTimer.h>

Description:

A PtTimer widget invokes a callback after an initial and repeated time period, given in milliseconds. This widget is intended to provide a non-accurate, resourceless time base for your application. To disable the timer, set Pt_ARG_TIMER_INITIAL to 0 or unrealize the widget.

When you create a PtTimer widget in PhAB, it appears as a black box. The box doesn't appear when you run the application; it's just a placeholder.


Note: PtTimer is easy to use, but doesn't give accurate timer events. In particular, it doesn't guarantee a constant repeat rate; since the repetition is handled by rearming the timer for each event, any delays in handling the events accumulate. Kernel timers guarantee an accurate repeat rate even if your application can't keep up with them. For more information, see Timers in the Working with Code chapter of the Photon Programmer's Guide.

New resources:

Resource C type Pt type Default
Pt_ARG_TIMER_INITIAL unsigned long Scalar 0
Pt_ARG_TIMER_REPEAT unsigned long Scalar 0
Pt_CB_TIMER_ACTIVATE PtCallback_t * Link NULL

Pt_ARG_TIMER_INITIAL

C type Pt type Default
unsigned long Scalar 0

The time, in milliseconds, before the first timer callback is activated.

Pt_ARG_TIMER_REPEAT

C type Pt type Default
unsigned long Scalar 0

The time, in milliseconds, for the repeat rate of the timer once the initial time period has expired.

Pt_CB_TIMER_ACTIVATE

C type Pt type Default
PtCallback_t * Link NULL

A list of PtCallback_t structures that define the callbacks that the widget invokes when the timer has expired.

Each callback is passed a PtCallbackInfo_t structure that contains at least the following members:

reason
Pt_CB_TIMER_ACTIVATE
reason_subtype
One of:
event
A pointer to a PhEvent_t structure that describes the event that caused the callback to be invoked.
cbdata
NULL.

These callbacks should return Pt_CONTINUE.

Inherited resources:

If the widget modifies an inherited resource, the “Default override” column indicates the new value. This modification affects any subclasses of the widget.

Resource Inherited from Default override
Pt_ARG_ANCHOR_FLAGS PtWidget Not used by this class.
Pt_ARG_ANCHOR_OFFSETS PtWidget Not used by this class.
Pt_ARG_AREA PtWidget Not used by this class.
Pt_ARG_BITMAP_CURSOR PtWidget Not used by this class.
Pt_ARG_BEVEL_WIDTH PtWidget Not used by this class.
Pt_ARG_CURSOR_COLOR PtWidget Not used by this class.
Pt_ARG_CURSOR_TYPE PtWidget Not used by this class.
Pt_ARG_DATA PtWidget
Pt_ARG_DIM PtWidget Not used by this class.
Pt_ARG_EFLAGS PtWidget Not used by this class.
Pt_ARG_EXTENT PtWidget Not used by this class.
Pt_ARG_FLAGS PtWidget
Pt_ARG_HEIGHT PtWidget Not used by this class.
Pt_ARG_HELP_TOPIC PtWidget Not used by this class.
Pt_ARG_MAXIMUM_DIM PtWidget Not used by this class.
Pt_ARG_MINIMUM_DIM PtWidget Not used by this class.
Pt_ARG_POINTER PtWidget
Pt_ARG_POS PtWidget Not used by this class.
Pt_ARG_RESIZE_FLAGS PtWidget Not used by this class.
Pt_ARG_USER_DATA PtWidget
Pt_ARG_WIDTH PtWidget Not used by this class.
Pt_CB_BLOCKED PtWidget Not used by this class.
Pt_CB_DESTROYED PtWidget
Pt_CB_DND PtWidget
Pt_CB_FILTER PtWidget Not used by this class.
Pt_CB_HOTKEY PtWidget Not used by this class.
Pt_CB_IS_DESTROYED PtWidget
Pt_CB_OUTBOUND PtWidget Not used by this class.
Pt_CB_RAW PtWidget Not used by this class.
Pt_CB_REALIZED PtWidget
Pt_CB_UNREALIZED PtWidget