Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/photon/lib_ref/pt/ptaddeventhandler.html on line 1

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/photon/lib_ref/pt/ptaddeventhandler.html on line 1

Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/photon/lib_ref/pt/ptaddeventhandler.html on line 8

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/photon/lib_ref/pt/ptaddeventhandler.html on line 8

PtAddEventHandler()

Add a single Pt_CB_RAW entry to a widget

Synopsis:

void PtAddEventHandler( PtWidget_t *widget,
                        unsigned long event_mask,
                        PtCallbackF_t *callback,
                        void *data );

Library:

ph

Description:

This function adds the specified callback to the Pt_CB_RAW callback list that belongs to widget. The widget invokes this callback whenever an event type that matches one of the bits in event_mask intersects with the widget.


Note: The widget needs to have Pt_GETS_FOCUS set in its Pt_ARG_FLAGS in order to receive key events.

The callback argument points to a function that takes this form:

int (*callback) (
        PtWidget_t *widget,
        void *data,
        PtCallbackInfo_t *info)

The data argument that you pass to PtAddEventHandler() is passed as the data argument to the callback function.

Examples:

PtWidget_t *widget;

PtRawCallback_t callbacks[] = {
    Ph_EV_PTR_MOTION_BUTTON,
    motion_button_callback,
    NULL, 
    Ph_EV_BUT_PRESS | Ph_EV_BUT_RELEASE, 
    start_end_callback,
    "some data"
}
...
//add both event handlers
PtAddEventHandlers( widget, callbacks, 2 );
...
//remove both event handlers
PtRemoveEventHandlers( widget, callbacks, 2 );
...
//add the motion button event handler
PtAddEventHandler( widget, Ph_EV_PTR_MOTION_BUTTON, 
                   motion_button_callback, NULL );
...
//remove the motion button event handler
PtRemoveEventHandler( widget, Ph_EV_PTR_MOTION_BUTTON, 
                      motion_button_callbacks, NULL )
...
//add both event handlers
PtAddEventHandlers( widget, callbacks, 2 );
...
//remove the motion button event handler
PtRemoveEventHandler( widget, Ph_EV_PTR_MOTION_BUTTON, 
                      motion_button_callbacks, NULL )

// at this point widget still has the Ph_EV_BUT 
// Press/Release event handler 

Classification:

Photon

Safety:
Interrupt handler No
Signal handler No
Thread No

See also:

PtAddCallback(), PtAddCallbacks(), PtAddEventHandlers(), PtAddFilterCallback(), PtAddFilterCallbacks(), PtAddHotkeyHandler(), PtRemoveEventHandler(), PtRemoveEventHandlers()

PtCallbackInfo_t, PtRawCallback_t, Pt_CB_RAW (PtWidget) in the Photon Widget Reference

Event handlers in the Managing Widgets in Application Code chapter of the Photon Programmer's Guide


Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/photon/lib_ref/pt/ptaddeventhandler.html on line 172

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/photon/lib_ref/pt/ptaddeventhandler.html on line 172