Constraint initialize() Constraint initialize()Name
Constraint initialize - Constraint class method to initialize a child
object or widget's constraint record.
typedef void (*XtInitProc)(Widget, Widget, ArgList, Cardinal *);
request Specifies the newly created child widget or object instance
with its constraint record resource values set as requested
by the argument list, the resource database, and the con‐
init Specifies the same widget or object with its constraint
record fields as modified by any superclass Constraint ini‐
args Specifies the argument list that was passed to XtCreateWid‐
num_args Specifies the number of entries in the argument list.
The Constraint initialize() method is registered on the initialize
field of the Constraint class part structure, and is called by XtCre‐
ateWidget() when a child of the constraint widget is created. The Con‐
straint initialize() method performs the same sort of initializations
on the constraint record of a widget that the normal (Object, RectObj,
or Core) initialize() method performs on the widget instance structure.
The request and init arguments specify the child widget that is being
created. The constraints field of the request widget points to a copy
of the constraint record as it was after all of the constraint
resources were initialized from the argument list, the resource data‐
base, or the resource list defaults. The constraints field of the init
widget points to the actual constraints record of the widget, and has
been further initialized by the Constraint initialize() method of any
Constraint superclasses of the parent widget. All modifications should
be made to the init constraints record; the request argument exists so
that the widget class can determine which field of the constraints
record have been modified by superclass Constraint initialize() meth‐
The Constraint initialize() method is chained in superclass-to-subclass
order, and cannot be inherited. If nothing in the constraint structure
needs initialization, the Constraint class part initialize field should
The args and num_args arguments were added to this method in Release 4.
See initialize(4) for an explanation of the things that an initialize
procedure should do. See XtCreateWidget(1) for full details of the
widget creation process.
The following procedure is the Constraint initialize() method, slightly
modified, of the Athena Form widget class. Note how it obtains the
constraint record and the parent form widget from the supplied child
widget. Note also that it provides "dynamic defaults" for two of its
constraint resources: if dx or dy is equal to some default value (i.e.,
if it was not explicitly specified), then it will be replaced by the
value of the XtNdefaultSpacing resource from the Form widget itself.
Note that this procedure (and most other initialize() procedures in
existence) has named its init argument new. "new" is a reserved word
in C++, and your programs will be more portable if you avoid using it
in your C code.
/* ARGSUSED */
static void ConstraintInitialize(request, new, args, num_args)
Widget request, new;
FormConstraints form = (FormConstraints)new->core.constraints;
FormWidget fw = (FormWidget)new->core.parent;
form->form.virtual_width = (int) new->core.width;
form->form.virtual_height = (int) new->core.height;
if (form->form.dx == default_value)
form->form.dx = fw->form.default_spacing;
if (form->form.dy == default_value)
form->form.dy = fw->form.default_spacing;
form->form.deferred_resize = False;
Constraint destroy(4), initialize(4), Constraint set_values(4).
Xt - Intrinsics Methods Constraint initialize()