background image
C H A P T E R 1 0
Recognition: Advanced Topics
10-40
Using Advanced Topics in Recognition
Customized Processing of Input Strokes
10
Setting the
vStrokesAllowed
flag provides the view with a means of intercepting
raw input data for application-specific processing. If this flag is set, strokes are
passed one at a time as the argument to the view's
ViewStrokeScript
method.
Your
ViewStrokeScript
method can then process the strokes in any manner
that is appropriate. The view's
ViewStrokeScript
method is invoked when the
user lifts the pen from the screen at the end of each input stroke.
Both the
vGesturesAllowed
and
vStrokesAllowed
flags invoke methods
that can be used to provide application-specific handling of gestures. However, the
vGesturesAllowed
flag supplies system-defined behavior for the gestures tap,
double-tap, highlight, and scrub in
clEditView
and
clParagraphView
views,
while the
vStrokesAllowed
flag does not provide any behavior that you don't
implement yourself, regardless of the kind of view performing recognition.
For example,
clEditView
and
clParagraphView
views handle system-
defined gestures automatically. Thus, scrubbing in a
clParagraphView
view that
sets the
vGesturesAllowed
flag does not invoke the
ViewGestureScript
method because the view handles this gesture automatically. On the other hand, a
clView
view would need to supply a
ViewGestureScript
method to process
the scrub gesture because this kind of view does not provide any gesture-handling
behavior of its own. Finally, remember that any view setting the
vStrokesAllowed
flag must also supply a
ViewStrokeScript
method.
Setting these flags causes the recognition system to send messages such as
ViewClickScript
or
ViewStrokeScript
, passing a unit (an object that
describes the interaction of the pen with the tablet) as the argument to the
corresponding methods. Units are only valid when accessed from within the
methods invoked during the recognition process--you cannot save them for later
use. However, you can distribute the processing of unit data as appropriate; for
example, you might call the
GetPointsArray
function from within your
ViewClickScript
method and use the result later in your
ViewIdleScript
method.
IMPORTANT
Do not save units for later use--they are valid only during the
recognition process. After the user interaction is complete and the
various scripts utilizing a particular unit have returned, the
memory allocated for that unit is freed explicitly. Subsequent use
of the unit may produce bus errors or loss of significant data.
© 2007-2024, o7 studio » при воспроизведении материала сайта ссылка обязательна