C H A P T E R 1 0
Recognition: Advanced Topics
Using Advanced Topics in Recognition
Sketch ink, like shapes, is displayed only in views based on the
class. As a rule of thumb, consider sketch ink and ink text to be mutually exclusive
when configuring recognition in views; for best results, configure your input view
to recognize only one of these two data types.
Views based on the
class handle sketch ink and ink text automatically.
For other views, the system invokes the view's
method when ink arrives. For more details, see the
descriptions of these methods in Newton Programmer's Reference.
constant provides a ready-to-use
frame that allows views based on the
contain ink text in addition to normal text. To use this
frame to create
a view that supports ink text, you'll need to take the following steps:
Create a view template that protos from the
In your view template, create a
slot that holds the
constant. For more information, see "Creating a recConfig
Frame" beginning on page 10-9.
view that allows the user to choose text or ink
text settings; if your application provides a status bar, you need to provide the
view as one of its children. For more information, see "Creating
the recToggle View" beginning on page 10-19.
slot at an appropriate position in the
chain. For more information see "Creating the _recogSettings
Slot" beginning on page 10-20.
Normally, the input view tries to recognize input using all currently enabled
recognizers. If no recognizers are enabled or if recognition fails for some reason--
for example, due to messy input or some sort of error--then the view system
converts the input strokes into ink. The
slot in the
frame specifies the kind of ink that the system creates
from the input strokes.
slot holds a non-
value, the system
returns ink text; when this slot holds the
value, the system returns sketch ink.
This slot is described fully in "protoRecConfig" (page 8-36) in Newton
Programmer's Reference. Table 10-1 on page 10-12 summarizes the kinds of data
returned by the recognition system when recognition fails in an edit view or
paragraph view that is controlled by a
Note that when the input view is set to recognize shapes, the smoothed and cleaned
up ink that is returned may be ink text but is more likely to be a curve shape. Aside
from the failure of shape recognition, the only time raw ink is returned to the view
is when its associated
is set to "Sketches".