
CHAPTER 10
Recognition: Advanced Topics
Using Advanced Topics in Recognition 10-17
The PurgeAreaCache function causes the recognition system to adopt the
settings that the
recConfig frame specifies. This function is explained in more
detail in the next section, “Changing Recognition Behavior Dynamically.”
Normally, you need not call the
PurgeAreaCache function when specifying a
recConfig frame as part of a view’s template. However, you must call this
function to change a
recConfig 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
recConfig frame can be constructed.
Therefore, the grid view’s
recConfig frame is constructed from within the
ViewSetupDoneScript method of the parent view that encloses the grid view.
At the time the
viewSetupDoneScript method is executed, the system has
already used the
recConfig frame supplied by the enclosing view’s template. In
order to cause the system to use the new
recConfig frame—the one that defines
the grid view—the
ViewSetupDoneScript method must call the
PurgeAreaCache function.
Changing Recognition Behavior Dynamically 10
To change a view’s recognition behavior dynamically, you must indicate the view’s
new configuration (by setting view flags, changing the view’s
dictionaries
slot, or defining a
recConfig 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
viewFlags
or
recConfig slot affects that view only.
Note
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
function
SetValue to change the value of the view’s viewFlags slot or
recConfig slot. In addition to setting the new value, the SetValue function
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.
Komentarze do niniejszej Instrukcji