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

PtContainerHit()

Find the nth widget in an area

Synopsis:

PtWidget_t *PtContainerHit( PtWidget_t *container, 
                            unsigned n, 
                            PhRect_t const *rect );

Library:

ph

Description:

This function returns a pointer to the nth widget within the specified container that intersects with the rectangle provided in the PhRect_t structure pointed to by rect.

The coordinates of the rectangle are relative to the given container's canvas. If no widget intersects with rect, or if there are fewer than n intersections, the function returns NULL.

Examples:

PtWidget_t *target_widget, *my_pane;

// In my_pane's RAW callback:
my_raw_cb( PtWidget_t *container, void *data, 
           PtCallbackInfo_t *cbinfo )
{
    PhRect_t   *rect;
    PtWidget_t *container;
    PtWidget_t *target_widget;

//  …
    rect = PhGetRects( cbinfo->event );
    container  =  PtFindContainer( widget );
    target_widget = PtContainerHit( container, 1, rect );
    if (target_widget)
       PtDestroyWidget( target_widget );
//  …
}

Classification:

Photon

Safety:
Interrupt handler No
Signal handler No
Thread No

See also:

PhGetRects(), PhRect_t, PtContainerBox()