Caution: This version of this document is no longer maintained. For the latest documentation, see


Regular callback structure


typedef struct Pt_callback {
    int (*event_f)( PtWidget_t *, void *, 
                    PtCallbackInfo_t * );
    void *data;
    } PtCallback_t;


The PtCallback_t structure lets you specify a widget's callbacks when you call PtCreateWidget() or PtAddCallbacks().

This structure contains at least:

A pointer to the callback function.
A pointer to data that you want to pass as the second parameter to the callback function when it's invoked.

Callback functions

A callback function takes the following arguments:

PtWidget_t *widget
A pointer to the widget instance that invoked the callback.
void *client_data
The data from the PtCallback_t structure.

Note: A PhAB callback takes as its second argument a pointer to an ApInfo_t structure. For more information, see the Photon Library Reference.

PtCallbackInfo_t *cbinfo
A pointer to a common Photon callback structure. The structure provides information related to the widget callback being invoked, the Photon event, and some widget-specific callback data. The format of the data varies with the widget class and callback type. For more information, see PtCallbackInfo_t.

Callback functions should return Pt_CONTINUE unless the description of the widget's callback resource tells you to return something else.



See also:

PtBalloonCallback_t, PtCallbackInfo_t, PtHotkeyCallback_t, PtRawCallback_t

ApInfo_t, PtAddCallbacks(), PtCreateWidget() in the Photon Library Reference

Callbacks in the Managing Widgets in Application Code chapter of the Photon Programmer's Guide.