C H A P T E R 1 0
Recognition: Advanced Topics
Using Advanced Topics in Recognition
function causes the recognition system to adopt the
settings that the
frame specifies. This function is explained in more
detail in the next section, "Changing Recognition Behavior Dynamically."
Normally, you need not call the
function when specifying a
frame as part of a view's template. However, you must call this
function to change a
frame at run time. For example, the previous
code fragment calculates values determining the size and location of the grid view
according to the size of the enclosing parent view; thus, the parent view must
already exist before the grid view's
frame can be constructed.
Therefore, the grid view's
frame is constructed from within the
method of the parent view that encloses the grid view.
At the time the
method is executed, the system has
already used the
frame supplied by the enclosing view's template. In
order to cause the system to use the new
frame--the one that defines
the grid view--the
method must call the
Changing Recognition Behavior Dynamically
To change a view's recognition behavior dynamically, you must indicate the view's
new configuration (by setting view flags, changing the view's
slot, or defining a
frame) and make the recognition system use the
new settings. The system supplies three functions that you can use to make the
system adopt new recognition settings; each is appropriate for a particular situation.
The function you use to adopt new settings depends on whether you are changing
the recognition behavior of all views or just changing the behavior of individual
views. Changes to user preferences for recognition affect the recognition behavior
of all views. On the other hand, changing the value of a single view's
slot affects that view only.
It is recommended that you do not change any user settings
without confirmation from the user.
To change the recognition behavior of a single view dynamically, use the global
to change the value of the view's
slot. In addition to setting the new value, the
invalidates the area cache, which is a buffer that stores a small number of
recognition areas. Your changes to recognition behavior are incorporated when the
recognition area for your view is rebuilt.