beautypg.com

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

Page 386

background image

C H A P T E R 1 0

Recognition: Advanced Topics

10-10

Using Advanced Topics in Recognition

exact complement of slots and values required is determined by the recognition
features your

recConfig

frame is intended to supply; for more information,

including complete descriptions of the system-supplied

recConfig

frames, see

“System-Supplied recConfig Frames” (page 8-18) in Newton Programmer’s
Reference
.

Once you’ve created a RAM-based

recConfig

frame, you must cause the

recognition system to use it. This process is described in “Changing Recognition
Behavior Dynamically” beginning on page 10-17. For a code example showing
how to create a

recConfig

frame based on one of the system-supplied

prototypes, see “Creating Single-Letter Input Views” beginning on page 10-15.

Using RecConfig Frames to Enable Recognizers

10

To enable or disable recognizers unconditionally, supply appropriate values
for the

doTextRecognition

,

doShapeRecognition

, or

doInkWordRecognition

slots your view’s

recConfig

frame provides. For

descriptions of these slots, see “protoRecConfig” (page 8-36) in Newton
Programmer’s Reference
.

For some operations, you may wish to restrict the recognizers that the user can
enable in a view while still respecting the rest of the preferences indicated in the
system’s user configuration data. The optional slots

allowTextRecognition

and

allowShapeRecognition

in the view’s

recConfig

frame are intended

for use with views having an input mask that is

vAnythingAllowed

. For

complete descriptions of these slots, see “protoRecConfig” (page 8-36) in Newton
Programmer’s Reference
. Note that you can also allow the user to set the values of
these slots from a

protoRecToggle

view instead of setting them yourself in the

recConfig

frame.

Views that use the

allow

Something

Recognition

slots allow the user to turn on

only the recognizers that you specify while respecting all other user preferences.
Any subset of

allow

Something

Recognition

slots can be specified to allow

the user to enable any appropriate combination of recognizers from the

protoRecToggle

view or user preferences.

For example, setting the value of the

allowTextRecognition

slot to

true

allows the user to enable the text recognizer in the view controlled by the

recConfig

frame while the

doTextRecognition

slot in the system’s user

configuration data holds a non-

nil

value.

Returning Text, Ink Text or Sketch Ink

10

This section discusses the use of

recToggle

views with system-supplied view

classes and

recConfig

frames to provide views that can display text, ink text, or

sketch ink.