| ![[Previous]](../image-lib/prev.gif) | ![[Contents]](../image-lib/contents.gif) | ![[Index]](../image-lib/keyword_index.gif) | ![[Next]](../image-lib/next.gif) | 
Get the child that's farthest back in a container
PtWidget_t *PtWidgetChildBack( PtWidget_t *widget );
This function returns a pointer to the child that's farthest back in the specified container widget. If widget doesn't have any children, the function returns NULL.
window = PtAppInit( NULL, NULL, NULL, 0, NULL );
pos.x = pos.y = 0;
PtSetArg( &argt[0], Pt_ARG_POS, &pos, 0 );
PtSetArg( &argt[1], Pt_ARG_RESIZE_FLAGS, 
          Pt_TRUE, Pt_RESIZE_XY_ALWAYS );
PtSetArg( &argt[2], Pt_ARG_GROUP_ORIENTATION, 
          Pt_GROUP_HORIZONTAL, 0 );
group1 = PtCreateWidget( PtGroup, NULL, 3, &argt );
pos.x += 100;
PtSetArg( &argt[1], Pt_ARG_RESIZE_FLAGS, 
          Pt_TRUE, Pt_RESIZE_XY_ALWAYS );
PtSetArg( &argt[2], Pt_ARG_GROUP_ORIENTATION, 
          Pt_GROUP_HORIZONTAL, 0 );
group2 = PtCreateWidget( PtGroup, window, 3, &argt );
PtSetArg( &argt[0], Pt_ARG_TEXT_STRING, 
          "Group2 Child Back" );
PtCreateWidget( PtButton, NULL, 1, argt );
PtSetArg( &argt[0], Pt_ARG_TEXT_STRING, 
          "Group2 Child Middle" );
PtCreateWidget( PtButton, NULL, 1, argt );
//Set the default parent to "group1"
PtSetParentWidget( group1 )
PtSetArg( &argt[0], Pt_ARG_TEXT_STRING, 
          "Group1 Child Back" );
PtCreateWidget( PtButton, NULL, 1, argt );
PtSetArg( &argt[0], Pt_ARG_TEXT_STRING, 
          "Group1 Child Front" );
PtCreateWidget( PtButton, NULL, 1, argt );
PtSetArg( &argt[0], Pt_ARG_TEXT_STRING, 
          "Group2 Child Front" );
PtCreateWidget( PtButton, group2, 1, argt );
// walk the children of group2 back to front
PtSetArg( &argt[0], Pt_ARG_COLOR, Pg_BLUE, 0 );
for( wp = PtWidgetChildBack( pane2 ); 
     wp; 
     wp = PtWidgetBrotherInFront( wp ) )
{
    tmp = wp;
    if( PtWidgetIsClassMember( wp, PtLabel ) )
        PtSetResources( wp, 1, argt );
}
// move the frontmost widget to the back...
PtWidgetToBack( tmp );
// force a display Update
PtFlush();
// walk the children of group2 front to back
for( wp = PtWidgetChildFront( pane2 ); 
     wp; 
     wp = PtWidgetBrotherBehind( wp ) )
{
    tmp = wp;
    if( PtWidgetIsClassMember( wp, PtLabel ) )
        PtSetResources( wp, 1, argt );
}
PtWidgetToFront( tmp );
if( group2 == PtWidgetParent( group1 ) ) // not true...
    PtDestroyWidget( group1 );
    
if( window == PtWidgetParent( group1 ) ) // true...
    PtUnrealizeWidget( group1 ); 
    // removed from view without being destroyed.
// Set color of group 2 family to Pg_BLUE 
PtSetArg( &argt, Pt_ARG_COLOR, Pg_BLUE, 0 );
for( wp = group2; wp;wp = PtWidgetFamily( group2, wp ))
    PtSetResources( wp, 1, argt );
// destroy group 2 and all its children
PtDestroyWidget( group2 ); 
// force a display Update
PtFlush()
PtRealizeWidget( group1 ); // make group1 visible again.
PtMainLoop();
Photon
| Safety: | |
|---|---|
| Interrupt handler | No | 
| Signal handler | No | 
| Thread | No | 
PtWidgetBrotherBehind(), PtWidgetBrotherInFront(), PtWidgetChildFront(), PtWidgetInsert(), PtWidgetParent(), PtWidgetToBack(), PtWidgetToFront()
PtWindowToBack() PtWindowToFront() in the Photon Widget Reference.
"Ordering widgets" in the Creating Widgets in Application Code chapter of the Photon Programmer's Guide
| ![[Previous]](../image-lib/prev.gif) | ![[Contents]](../image-lib/contents.gif) | ![[Index]](../image-lib/keyword_index.gif) | ![[Next]](../image-lib/next.gif) |