[Previous] [Contents] [Index] [Next]


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.
Data that's passed 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.
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.

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

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



See also:

PtBalloonCallback_t, PtCallbackInfo_t, PtHotkeyCallback_t, PtRawCallback_t

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

"Manipulating callbacks in your code" in the Creating Widgets in Application Code chapter of the Photon Programmer's Guide.

[Previous] [Contents] [Index] [Next]