XtOrderProc()XtOrderProc()NameXtOrderProc - interface definition for an XtNinsertPosition procedure.
Synopsis
typedef Cardinal (*XtOrderProc)(Widget);
Widget w;
Inputs
w Specifies the widget.
Description
An XtOrderProc is registered as the value of the XtNinsertPosition
resource of a composite widget, and is called by some subclasses of
Composite to determine the position in the Composite children array at
which a newly created child should be inserted.
An XtOrderProc should return the position in the array at which w
should be inserted. A return value of zero means that it should be the
first widget in the array, a return value of one means that there
should be one widget before it in the array, and so on. A return value
equal to the XtNnumChildren resource indicates that the widget should
be placed at the end of the array, which is the default if no XtOrder‐
Proc is registered.
Usage
Note that for many composite widgets, the position of a child in the
children array has nothing to do with its position on the screen. The
XtNinsertPosition resource will only be interesting if the widget does
not provide any other method of positioning its children.
The Composite class insert_child() method calls the XtOrderProc, if
any, registered on the XtNinsertPosition resource. Most composite sub‐
classes inherit or call this procedure explicitly and will therefore do
the same.
Note that the XtNinsertPosition procedure is not a method of the widget
class. It could be considered an "instance method" rather than a
"class method." In this way it is similar to the procedure that can be
registered on the XtNcreatePopupChildProc resource of a shell widget.
Example
None of the standard MIT clients make use of the XtNinsertPosition
resource. An example of where an XtOrderProc might be useful is an
application that dynamically creates a number of button widgets (to
represent mail folders or newsgroups, perhaps) and places them in a
simple Xaw Box widget. Since these buttons will differ from user to
user, and can be inserted and deleted during a session, it would be
logical to place them in alphabetical order. An XtOrderProc could do
this by using XtGetValues() to get the current list of widget children,
and then comparing the name (using XtName()) of the specified widget
against the names of all the existing widgets.
See AlsoComposite(3),
delete_child(4), insert_child(4).
Xt - Geometry Management XtOrderProc()