Caution: This version of this document is no longer maintained. For the latest documentation, see http://www.qnx.com/developers/docs.

PtSendEventToWidget()

Give an event to a widget

Synopsis:

int PtSendEventToWidget( PtWidget_t *widget, 
                         PhEvent_t *event );

Library:

ph

Description:

This function passes the event in the given PhEvent_t structure directly to the given widget for processing.


Note: The widget expects the event to be followed immediately by the associated set of rectangles and event data. See the example below.

Returns:

The value returned by the last callback function invoked by the event, or -1 if an error occurred.

Examples:

// Send a Phantom release event to a widget.

Phantom( PtWidget_t *widget, PhEvent_t *event )
{
  struct{
    PhEvent_t event;
    PhRect_t  rect;
    PhPointerEvent_t pevent;
  } new_event;

  memset( &new_event.rect, -1 , 
          sizeof( new_event.rect ) );

  if( event ) {
    new_event.event = *event;
  }

  new_event.event.processing_flags = Ph_FAKE_EVENT;
  new_event.event.type = Ph_EV_BUT_RELEASE;
  new_event.event.subtype = Ph_EV_RELEASE_PHANTOM;;
  new_event.pevent.click_count = 1;
  new_event.pevent.buttons = Ph_BUTTON_SELECT;
  new_event.event.num_rects = 1;
  PtSendEventToWidget( widget, 
                       (PhEvent_t *) &new_event);
}

Classification:

Photon

Safety:
Interrupt handler No
Signal handler No
Thread No

See also:

PhEvent_t, PhEmit(), PhEmitmx(), PhPointerEvent_t

Events chapter of the Photon Programmer's Guide