[Previous] [Contents] [Index] [Next]

PtWidgetOffset()

Find the offset of a widget's origin

Synopsis:

PhPoint_t *PtWidgetOffset( PtWidget_t *widget,
                           PhPoint_t *offset );

Description:

This function determines the offset of widget's origin from its disjoint parent widget.

Returns:

A pointer to a PhPoint_t structure that's the offset of the widget's origin from its parent window (the widget's position is relative to this point), or NULL if an error occurs.

Examples:

PtArg_t arg;
PhPoint_t *widget_pos;

PtSetArg( &arg, Pt_ARG_POS, &widget_pos, 0);
PtGetResources( labelwidget, 1, &arg );

if(PtWidgetOffset( labelwidget, &point))
{
    widget_position_relative_to_window.x = 
          point.x + widget_pos->x;
    widget_position_relative_to_window.y = 
          point.y + widget_pos->y;
}

Classification:

Photon

Safety:
Interrupt handler No
Signal handler No
Thread No

See also:

PtGetAbsPosition(), PtTranslateRect()


[Previous] [Contents] [Index] [Next]