ApWidget()

Determine the widget that initiated a link callback

Synopsis:

#include <Ap.h>

PtWidget_t *ApWidget( PtCallbackInfo_t *cbinfo );

Arguments:

cbinfo
A pointer to the PtCallbackInfo_t structure (see the Photon Widget Reference) that was passed to the callback.

Library:

Ap

Description:

ApWidget() is used within module setup functions to determine the widget that initiated the link callback.

Returns:

A pointer to the initiating widget.

Examples:

mysetup_function( ..., PtCallbackInfo_t cbinfo ) {
    if (ApName(ApWidget(cbinfo)) == ABN_widget1) {
        /* setup based on widget1 */
    } else {
        if (ApName(ApWidget(cbinfo)) == ABN_widget2) {
            /* setup based on widget2 */
        } else {
            /* common setup */
        }
    }
    return( Pt_CONTINUE );
}

Classification:

Photon

Safety:
Interrupt handler No
Signal handler No
Thread No

See also:

For another method of determining the widget that initiated a link callback, see the ApInfo_t structure.

PtCallbackInfo_t in the Photon Widget Reference

Module setup functions in the Working With Code chapter of the Photon Programmer's Guide