Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/photon/lib_ref/pt/ptwidgetbrotherbehind.html on line 1

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/photon/lib_ref/pt/ptwidgetbrotherbehind.html on line 1

Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/photon/lib_ref/pt/ptwidgetbrotherbehind.html on line 8

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/photon/lib_ref/pt/ptwidgetbrotherbehind.html on line 8

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


Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/photon/lib_ref/pt/ptwidgetbrotherbehind.html on line 175

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/photon/lib_ref/pt/ptwidgetbrotherbehind.html on line 175