PtWidgetChildren

PtWidgetChildren — finds the children of a widget.

Syntax

PtWidgetChildren (widget)

		

Arguments

widget

The widget whose children are to be searched for.

Returns

A list of child widgets, if there are any, including definitions. Otherwise, nil.

Description

Example

This example, ex_PtWidgetChildren.g, is included in the product distribution.

#!/usr/cogent/bin/phgamma

/*
The following example makes a window with a pane and a label, and
prints the output of PtWidgetChildren() for the pane widget.  It
then prints the function output for the label widget, which is nil, as
it has no children.
*/

require_lisp("PhotonWidgets");
PtInit(nil);

win = new(PtWindow);
win.SetDim(150,150);
/*
but = new(PtButton);
but.text_string = "A button.";
*/
pane = new(PtPane);
pane.SetArea(20,20,100,100);
pane.fill_color = PgRGB(160,190,160);

label = new(PtLabel);
label.SetPos(25,25);
label.text_string = "A label.";


PtRealizeWidget(win);
pretty_princ("\nThe children of the ", class_name(pane), " are:\n",
			 PtWidgetChildren(pane),"\n");
pretty_princ("\nThe children of the ", class_name(label), " are:\n",
			 PtWidgetChildren(label),"\n");

PtMainLoop();