background image
C H A P T E R 1 0
Recognition: Advanced Topics
10-20
Using Advanced Topics in Recognition
Configuring Recognizers and Dictionaries for recToggle Views
10
Regardless of whether you use a
recConfig
frame or view flags to specify your
view's recognition behavior, the view must be capable of enabling recognizers and
dictionaries appropriate for each choice in the
recToggle
picker. If your view
does not support all of the recognition settings provided by the default
recToggle
view, you need to provide a
_recogPopup
slot that restricts the choices appearing
in the picker that the
recToggle
view displays. For more information, see
"Providing the _recogPopup Slot" beginning on page 10-22.
If you are using a
recConfig
frame to specify your view's recognition behavior,
you can place the
ROM_rcPrefsConfig
constant in your
recConfig
frame's
_proto
slot to provide a general-purpose
recConfig
frame that allows
recognition of all forms of pen input. Note that you must also enable recognition
behavior and dictionaries as appropriate in order to produce useful behavior.
Creating the _recogSettings Slot
10
Applications that use a
recToggle
view must provide a
_recogSettings
slot
in a view that is a parent to both the
recToggle
view and the input view it
controls. Your view template should specify an initial value of
nil
for this slot.
Each time the user chooses an item from the
recToggle
picker, it saves a value
representing its current setting in this slot. You can preserve the user's recognition
settings by saving the contents of this slot when your application closes and
restoring this slot's value when your application reopens.
When a single
recToggle
view controls recognition for all of your application's
views, the
_recogSettings
slot can reside in the application's base view, as
shown in Figure 10-5.
This approach can be used to synchronize the recognition behavior of multiple
views; for example, the built-in Notes application uses a single
recToggle
view
to control the recognition behavior of all currently visible notes. All of the views
controlled by a single
recToggle
view must provide the same set of recognizers
and dictionaries.
When each of several
recToggle
views must control individual input views, you
must provide a
_recogSettings
slot for each
recToggle
view at an
appropriate place in the
_parent
chain of each view that performs recognition, as
shown in Figure 10-6.
© 2007-2024, o7 studio » при воспроизведении материала сайта ссылка обязательна