![]() |
![]() |
![]() |
![]() |
![]() |
This version of this document is no longer maintained. For the latest documentation, see http://www.qnx.com/developers/docs. |
Add a single Pt_CB_RAW entry to a widget
void PtAddEventHandler( PtWidget_t *widget,
unsigned long event_mask,
PtCallbackF_t *callback,
void *data );
ph
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.
![]() |
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.
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
Photon
| Safety: | |
|---|---|
| Interrupt handler | No |
| Signal handler | No |
| Thread | No |
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
![]() |
![]() |
![]() |
![]() |