C H A P T E R 9
Using the Recognition System
this regard. If necessary, you can provide a
method that validates the recognizer's output; this method
can be especially useful when working with the printed recognizer.
Accepting Pen Input
When setting up any view, you must specify whether it accepts pen input at all. If
you set the
flag (or turn off all recognition-oriented flags), the
view does not accept pen input. If you want the view to accept pen input, you must
flag in its
slot. Setting this flag only causes the
view to accept pen taps and send
messages; it does not
enable ink handling or send messages to any of the unit-handling methods that
provide recognition behavior.
flag specifies that the view system is to send the
message to the view once for each pen tap that occurs within
the view. Note that this is the case only when
is the only flag set for
the view--other flags, such as the
flag, set the
bit in the view's input mask also.
When this flag is set, the system sends additional messages to the view to signal
taps, strokes, gestures, and words. All pen input is signaled by the
message, which indicates that the pen contacted the screen
or was lifted from it within the boundaries of the view. If you supply a
method, it should return
to indicate that the message
was handled, or
to pass the message on to another view. If this message is not
handled by the view and additional recognition flags are set, other messages may
be sent to the view, depending on what was written. These other messages include
order, if all are sent.
Each of the corresponding input-related view methods accept as an argument a unit
object passed to it by the system. The unit contains information about the pen
input. You cannot examine the unit directly from NewtonScript, but you can pass it
to other system-supplied functions that extract information from it such as the
beginning and ending points of the stroke, an array of stroke points, the stroke
bounds, and so on.
Taps and Overlapping Views
When views overlap, taps can "fall through" from the top view to the one beneath,
causing unexpected results. For example, when the user taps in an area of the top
view that doesn't handle taps, and the view beneath provides a button in the
vicinity of the tap, the button may be activated unintentionally.