beautypg.com

Enabling recognizers 9 – Apple Newton Programmer’s Newton 2.0 (for Newton 2.0) User Manual

Page 350

background image

C H A P T E R 9

Recognition

9-8

About the Recognition System

clParagraphView

view child. Ink text automatically wraps to the paragraph

boundaries, just as recognized text does. Ink text is also usually reduced in size
when it is drawn, according to the user preference specified by the Ink Text Scaling
item in the Text Editing preferences slip. Sketch ink, on the other hand, is treated as
a graphic: it is inserted into the view as a

clPolygonView

view child. Sketch ink

is always drawn at full size, and in the position at which it was written on the screen.

Thus, stroke bundles are normally returned only to views that do not perform
recognition. To cause the system to always return stroke bundles to the view (in
addition to any word units, gesture units or shape units that may be passed to the
view), set the view’s

vStrokesAllowed

flag and provide a

ViewStrokeScript

method, as described in “Customized Processing of Input Strokes” beginning on
page 10-40.

The recognition system’s classification of user input is essentially a process of
elimination. Enabling and configuring only the recognizers and dictionaries
appropriate to a particular context is the primary means by which you optimize the
recognition system’s performance within your application.

Enabling Recognizers

9

Each view has a

viewFlags

slot that contains a bit field. The bits in this field

specify characteristics that the view does not inherit from its view class, such as its
recognition behavior. When you set a view flag, it sets bits in this field to enable
combinations of recognizers and dictionaries suited to the input you anticipate the
view to receive.

Not all of the bits in this field affect recognition; some are used to set other
characteristics, such as the view’s placement on the screen. The bits in this field
that affect the recognition system are referred to as the view’s input mask. When
the view is constructed at run time, the system copies the input mask bits and other
view flags’ bits into the view’s

viewFlags

slot. shows the relationship of

recognition-related view flags to bits in the

viewFlags

slot.

You can set bits in the

viewFlags

slot from within the graphical view editor in

Newton Toolkit or you can set them programmatically from within your own
NewtonScript code. Either approach allows you to set combinations of bits to
produce a variety of behaviors.

This book uses the NewtonScript approach for all examples. For information on
using the graphical view editor in Newton Toolkit, see Newton Toolkit User’s Guide.