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

PtWidgetBrotherBehind()

Get the brother behind a widget

Synopsis:

PtWidget_t *PtWidgetBrotherBehind( 
                PtWidget_t *widget);

Arguments:

widget
A pointer to the widget whose brother you want to find.

Library:

ph

Description:

This macro returns a pointer to the brother behind widget. If there's no brother behind widget, the macro returns NULL.

Examples:

#include <stdlib.h>
#include <Pt.h>

int main ()
{
  PtWidget_t *window, *group, *child;
  PtArg_t  argt[5];
  char *name;

  if (PtInit(NULL) == -1)
    exit(EXIT_FAILURE);

  if ((window = PtCreateWidget(PtWindow, Pt_NO_PARENT,
                               0, NULL)) == NULL)
    PtExit(EXIT_FAILURE);

  group = PtCreateWidget( PtGroup, Pt_DEFAULT_PARENT, 0, NULL );

  /* Create some buttons in the group. */
  PtSetArg( &argt[0], Pt_ARG_TEXT_STRING, "Child 1", 0 );
  PtCreateWidget( PtButton, Pt_DEFAULT_PARENT, 1, argt );
  PtSetArg( &argt[0], Pt_ARG_TEXT_STRING, "Child 2", 0 );
  PtCreateWidget( PtButton, Pt_DEFAULT_PARENT, 1, argt );
  PtSetArg( &argt[0], Pt_ARG_TEXT_STRING, "Child 3", 0 );
  PtCreateWidget( PtButton, Pt_DEFAULT_PARENT, 1, argt );
  PtSetArg( &argt[0], Pt_ARG_TEXT_STRING, "Child 4", 0 );
  PtCreateWidget( PtButton, Pt_DEFAULT_PARENT, 1, argt );

  /* Traverse the group from back to front. */
  
  printf ("From back to front:\n");
  for (child = PtWidgetChildBack( group ); child;
       child = PtWidgetBrotherInFront( child ))
  {
     PtGetResource ( child, Pt_ARG_TEXT_STRING, &name, 0);
     printf ("  %s\n", name);
  }
   
  /* Traverse the group from front to back. */

  printf ("\nFrom front to back:\n");
  for (child = PtWidgetChildFront( group ); child;
       child = PtWidgetBrotherBehind( child ))
  {
     PtGetResource ( child, Pt_ARG_TEXT_STRING, &name, 0);
     printf ("  %s\n", name);
  }
   
  PtRealizeWidget (window);
  PtMainLoop();
  return EXIT_SUCCESS;
}

The above code produces this output:

From back to front:
  Child 1
  Child 2
  Child 3
  Child 4

From front to back:
  Child 4
  Child 3
  Child 2
  Child 1

Classification:

Photon

Safety:
Interrupt handler No
Signal handler No
Thread No

See also:

PtWidgetBrotherInFront(), PtWidgetChildBack(), PtWidgetChildFront(), PtWidgetParent()

"Ordering widgets" in the Managing Widgets in Application Code chapter of the Photon Programmer's Guide