background image
C H A P T E R 1 0
Recognition: Advanced Topics
10-28
Using Advanced Topics in Recognition
// store the dictionary data
dictData := {data:theObj};
mySoup:AddXmit(dictData, nil);
Restoring Dictionary Data From a Soup
10
To use the dictionary, your application needs to retrieve the dictionary data object
from the soup and use the global function
SetDictionaryData
to install the
data in an empty dictionary. This is typically done in the application part's
InstallScript
function or in the
ViewSetupFormScript
method of the
view that uses the custom dictionary, as shown in the following code example:
// make new blank dictionary
mySpecialDictionary := NewDictionary('custom);
// get the dictionary data from the soup
// structure of query depends on how you store data
dataCursor:=
dictDataSoup
:Query(
querySpec
);
// how you get entry depends on how you store data
myBinaryData := dataCursor:entry();
// put data in dictionary
SetDictionaryData(mySpecialDictionary, myBinaryData);
Note that RAM-based dictionaries are lost when the system resets. However, the
system calls your application part's
InstallScript
function after a reset. This
function can determine whether the dictionary exists and recreate it if necessary.
Because this function is also called when a card with your application on it is
inserted, as well as when the application is installed initially, it provides an ideal
place from which to install your custom dictionary.
Using Your RAM-Based Custom Dictionary
10
Take the following steps to make your RAM-based dictionary available to each
view that is to use it for recognition:
1. Set the view's
vCustomDictionaries
flag.
2. Create a
dictionaries
slot. You can create this slot in the view itself or in its
recConfig
frame.
3. Place your dictionary's identifier in the
dictionaries
slot.
To enable the use of custom dictionaries, you must set the
vCustomDictionaries
flag for the view that is to use the custom dictionary. This flag indicates that the
view has access to a slot named
dictionaries
that specifies dictionaries to be
used for recognition. The dictionaries specified in this slot are used in conjunction
with any other dictionaries that may be specified for this view's use.
© 2007-2024, o7 studio » при воспроизведении материала сайта ссылка обязательна