beautypg.com

Complex view effects 3, Making modal views 3 – Apple Newton Programmer’s Newton 2.0 (for Newton 2.0) User Manual

Page 122

background image

C H A P T E R 3

Views

3-38

Using Views

Each of the three return values contains three elements:

Element 0: the subview that is highlighted. This subview is usually
a

clParagraphView

, but you need to check to make sure. A

clPolygonView

is not returned here even if

HiliteOwner

returns a

clEditView

when a

clPolygonView

child is highlighted.

Element 1: the start position of the text found in the text slot of a

clParagraphView

.

Element 2: the end position of the text found in the text slot of a

clParagraphView

.

To verify that your view is a

clParagraphView

, check the

viewClass

slot of

the view. The value returned (dynamically) sometimes has a high bit set so you
need to take it into consideration using a mask constant,

vcClassMask

:

theviews.viewClass=clParagraphView OR

theView.viewClass - vcClassMask=clParagraphView

BAnd(thViews.viewClass, BNot(vcClassMask))=clParagraphView

If a graphic is highlighted and

HiliteOwner

returns a

clEditView

, check its

view children for non-

nil

values of the '

hilites

slot (the '

hilites

slot is for

use in any view but its contents are private).

Complex View Effects

3

If you have an application that uses

ViewQuitScript

in numerous places, your

view may close immediately, but to the user the Newton may appear to be hung
during the long calculations. A way to avoid this is to have the view appear open
until the close completes.

You can accomplish this effect in one of two ways. First, put your code in

ViewHideScript

instead of

ViewCloseScript

. Second, remove the view’s

ViewEffect

and manually force the effect at the end of

ViewQuitScript

using the

Effect

method.

Making Modal Views

3

A modal view is one that primarily restricts the user to interacting with that view.
All taps outside the modal view are ignored while the modal view is open.

In the interest of good user interface design, you should avoid using modal views
unless they are absolutely necessary. However, there are occasions when you may
need one.