background image
C H A P T E R 9
Recognition
9-24
Using the Recognition System
this regard. If necessary, you can provide a
ViewWordScript
or
ViewChangedScript
method that validates the recognizer's output; this method
can be especially useful when working with the printed recognizer.
Accepting Pen Input
9
When setting up any view, you must specify whether it accepts pen input at all. If
you set the
vNothingAllowed
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
set the
vClickable
flag in its
viewFlags
slot. Setting this flag only causes the
view to accept pen taps and send
ViewClickScript
messages; it does not
enable ink handling or send messages to any of the unit-handling methods that
provide recognition behavior.
Setting the
vClickable
flag specifies that the view system is to send the
ViewClickScript
message to the view once for each pen tap that occurs within
the view. Note that this is the case only when
vClickable
is the only flag set for
the view--other flags, such as the
vCustomDictionaries
flag, set the
vClickable
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
ViewClickScript
message, which indicates that the pen contacted the screen
or was lifted from it within the boundaries of the view. If you supply a
ViewClickScript
method, it should return
true
to indicate that the message
was handled, or
nil
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
ViewStrokeScript
,
ViewGestureScript
, and
ViewWordScript
--in that
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
9
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.
© 2007-2024, o7 studio » при воспроизведении материала сайта ссылка обязательна