background image
C H A P T E R 9
Recognition
9-26
Using the Recognition System
Double Taps" beginning on page 10-41. See also "ViewGestureScript" (page 8-71)
in Newton Programmer's Reference.
Combining View Flags
9
Generally, you must combine multiple view flags to produce useful recognition
behavior. For example, most views that accept user input set the
vClickable
flag
to enable pen input and the
vGesturesAllowed
flag to enable recognition of
standard gestures such scrubbing and inserting spaces.
Except where noted otherwise, the NewtonScript "plus" operator (+) is used to
combine view flags, as in the following code fragment.
myViewTemplate :=
{
// recognize taps, gestures, and shapes
viewFlags: vClickable+vGesturesAllowed+vShapesAllowed,
...}
Note
Most combinations of view flags include the
vClickable
flag.
If you do not set the
vClickable
flag, the view does not accept
pen input at all.
Sometimes a particular combination of view flags produces results that seem
incorrect. For example, you might be surprised to discover that a view setting only
the flags
vClickable+vLettersAllowed
can occasionally recognize numeric
values. (The
vLettersAllowed
flag enables the recognition of single text
characters by the cursive recognizer.) This behavior is caused by the presence of
the symbols dictionary in the set of dictionaries available to the view. The symbols
dictionary includes alphabetic characters, numerals and some punctuation marks.
Most view flags enable this dictionary to support the correction of single letters or
numerals by overwriting. As a side effect, it becomes possible to recognize
extraneous characters or numerals in fields that ostensibly should not support such
input. This behavior is rarely a problem, however, because the recognition system
is designed to show a strong preference for "appropriate" interpretations of input as
defined by the view flags set for the view.
Although you might expect that the presence of the symbols dictionary would
allow a view setting only the flags
vClickable+vNumbersAllowed
to return
alphabetic characters, this behavior is quite difficult to produce. Views that set the
vNumbersAllowed
flag show a much stronger preference for single-digit
numbers than single alphabetic characters. However, letters that do not look similar
to numeric values--for example, the letter W--may produce this particular form of
misrecognition.
© 2007-2017, o7 studio » при воспроизведении материала сайта ссылка обязательна