Examples
FIGURE 6.8 : Calculator application in portrait and landscape modes.
FIGURE 6.9 : Application with top-to-bottom or side-by-side views.
viewSetupFormScript
to view2
which changes its viewJustify
slot as it opens:
func() begin inherited:?viewSetupFormScript(); local parentBounds := :Parent():LocalBox(); if parentBounds.right > parentBounds.bottom then begin // landscape mode self.viewJustify := vjParentTopV + vjSiblingRightH; end else begin // portrait mode self.viewJustify := vjSiblingBottomV + vjParentLeftH; end; endThe code checks to see whether it is located within a view which is wide or tall. If it is wide, then the justification is right-justified to its sibling; if it is tall, then the justification is bottom-justified to its sibling.
Note that there is no explicit check to see whether the Newton is in rotated mode or not. Instead, we check what actually matters: is the view we are in wider than it is tall?
An online version of Programming for the Newton using Macintosh, 2nd ed. ©1996, 1994, Julie McKeehan and Neil Rhodes.
Last modified: 1 DEC 1996