Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ ConstraintB(3) — OSF1 1.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

Composite(3)

Constraint(3)

Core(3)

destroy(4)

set_values(4)

 

Name

Constraint initialize — Constraint method to initialize constraint resources. 

Synopsis

typedef void (∗XtInitProc)(request, new);

    Widget request, new;

Arguments

requestSpecifies the widget with resource values as requested by the argument list, the resource database, and the widget defaults. 

newSpecifies a widget with the new values, both resource and nonresource, as modified by the initialize procedure. 

Description

The Constraint initialize method of a Constraint parent is called just after the Core initialize method of a child is called during child creation.  The Constraint initialize method should compute any constraint fields derived from constraint resources.  It can make changes to the child widget to make it conform to the specified constraints; for example, changing the child’s size or position. 

The values passed to the parent Constraint initialize method are the same as those passed to the child’s initialize method. 

If a Constraint class does not need a Constraint initialize method, it can specify NULL for the initialize field of the ConstraintClassPart in the class record. 

Examples

The following is the Constraint initialize method of the Athena Form widget class:

/∗ ARGSUSED ∗/
static void ConstraintInitialize(request, new)
    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;
}

See Also

Composite(3), Constraint(3), Core(3),
Constraint destroy(4), Constraint set_values(4). 

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026