beautypg.com

Apple Newton Programmer’s Newton 2.0 (for Newton 2.0) User Manual

Page 302

background image

C H A P T E R 8

Text and Ink Input and Display

8-10

Using Text

IMPORTANT

You store view templates (not view objects) in the

viewChildren

array of an edit view.

Paragraph Views

8

The

clParagraphView

class displays text or accepts text input. It includes the

following features:

Text recognition

Text correction

Text editing, including scrubbing, selection, copying to the clipboard, pasting
from the clipboard, and other gestures, including duplicating, as controlled by
the setting of the

viewFlags

slot.

Automatic word-wrapping.

Support for the caret gesture, which adds a space or splits a word.

Clipping of text that won’t fit in the view. (An ellipsis is shown to indicate text
beyond what is visible.)

Use of ink and different text fonts (styles) within the same paragraph.

Tab-stop alignment of text.

Automatic resizing to accommodate added text (when this view is enclosed in a

clEditView

). This feature is controlled by the

vCalculateBounds

flag in

the

viewFlags

slot.

Automatic addition of new words written near the view when this view is
enclosed in a

clEditView

and caret insertion writing mode is disabled.

The slots of

clParagraphView

are described in “Paragraph View

(clParagraphView)” (page 7-15) in Newton Programmer’s Reference.

Note that you don’t need to create paragraph views yourself if you are accepting
user input inside a

clEditView

. Just provide a

clEditView

and when the user

writes in it, the view automatically creates paragraph views to hold text.

The following is an example of a template defining a view of the

clParagraphView

class:

dateSample := {...

viewClass: clParagraphView,

viewBounds: {left:50, top:50, right:200, bottom:70},

viewFlags: vVisible+vReadOnly,

viewFormat: vfFillWhite,

viewJustify: oneLineOnly,

text: "January 24, 1994",