beautypg.com

Recognizing shapes 9, Recognizing standard gestures 9 – Apple Newton Programmer’s Newton 2.0 (for Newton 2.0) User Manual

Page 367

background image

C H A P T E R 9

Recognition

Using the Recognition System

9-25

You can solve this problem by setting the top view’s

vClickable

flag without

providing a

ViewClickScript

method. (The top view need not handle the taps,

only prevent them from being passed on to the other view.)

Recognizing Shapes

9

The

vShapesAllowed

flag enables the recognition of geometric shapes such as

circles, straight lines, polygons, and so on. Do not set this flag for views that
handle text input only. This flag is intended for use only in views based on the

clEditView

class. The

clEditView

class provides the built-in Notepad

application’s note stationery with much of its recognition behavior.

The shapes displayed on the screen are

clPolygon

views returned as the children

of the

clEditView

that accepted the input strokes. There is no developer

interface to shape recognition; to manipulate shapes returned by the recognition
system, you must extract the polygon views from the edit view yourself. In some
cases, you may find the

ViewAddChildScript

method useful for this purpose.

The

ViewAddChildScript

message is sent when a child view is added to a view.

When multiple shapes are returned to an edit view, its

ViewAddChildScript

method is called once for each shape.

When multiple ink text words are returned to an edit view, the

ViewAddChildScript

method is invoked when the

clParagraphView

that

holds the ink text is added as the child of the edit view, but this method is not
invoked as ink text words are added to the paragraph view.

In views not based on the

clEditView

class, the arrival of each ink word is

signalled by a

ViewInkWordScript

message.

Recognizing Standard Gestures

9

Setting the

vGesturesAllowed

flag supplies system-defined behavior for the

gestures tap, double tap, highlight, scrub, line, caret, and caret-drag. Most input
views set the

vGesturesAllowed

flag, as they need to respond to standard

gestures such as scrubbing to delete text or ink. At present, you cannot define new
gestures to the system.

When the

vGesturesAllowed

flag is set, the gesture recognizer invokes the

view’s

ViewGestureScript

method before handling the gesture. Normally,

you don’t need to supply a

ViewGestureScript

method for

clEditView

or

clParagraphView

views. These views handle all system-defined gestures

automatically.

Your

ViewGestureScript

method is invoked only for gestures that the view

system does not handle automatically. For information on intercepting standard
gestures before the view system handles them, see “Customized Processing of