Justification

Parent Justification

When you justify a view relative to a parent, the view's viewBounds are relative to the parent's viewBounds coordinates. You can justify a view horizontally in any of these ways:

You can also justify a view vertically using similar settings:

As you can see, any boundary of a view can be used as the basis of the justification. Which justification you choose depends on exactly what effects you want. In some cases, you will also find that more than one choice will work equally well.

It is important to understand that once you add a viewJustify slot to a view template, its viewBounds slot's values are interpreted relative to the view justification you specify. In fact, you can't even interpret the meaning of the viewBounds until you know the justification of a view. In FIGURE 5.12, you can see a view, child, whose viewBounds never changes even though its position does. What changes is the type of justification specified.

FIGURE 5.12 : Changing the justification of a child view.


In each case, child's viewBounds remains the same (left: 0, right: 20, top: 0, bottom: 20). What changes is which of the parent's bounds is used as the basis for defining 0,0.

Left and Right Justification
Top and Bottom Justification
Center Justification
Full Justification
Uses of Parent Justification by Protos

An online version of Programming for the Newton using Macintosh, 2nd ed. ©1996, 1994, Julie McKeehan and Neil Rhodes.

Last modified: 1 DEC 1996