Newton 2.x Q&A Category: Recognition

Copyright © 1997 Newton, Inc. All Rights Reserved. Newton, Newton Technology, Newton Works, the Newton, Inc. logo, the Newton Technology logo, the Light Bulb logo and MessagePad are trademarks of Newton, Inc. and may be registered in the U.S.A. and other countries. Windows is a registered trademark of Microsoft Corp. All other trademarks and company names are the intellectual property of their respective owners.


For the most recent version of the Q&As on the World Wide Web, check the URL: http://www.newton-inc.com/dev/techinfo/qa/qa.htm
If you've copied this file locally, click here to go to the main Newton Q&A page.
This document was exported on 7/23/97.

Recognition


Custom Recognizers (2/8/96)

Q: Can I build recognizers for gestures and objects other than those built into the Newton system?

A: In Newton 2.0 OS, theres no support to add custom recognizers using the Newton Toolkit. Stay tuned for more information concerning this.

Some recognition engines can work in a window separate from the edited text. For instance, writing a "w" in a special view might causes "w" to appear in the currently edited text view (the key view.) This type of recognition system can be implemented as a keyboard. If you want to use this approach, you might want to use a function in the Newton 2.0 Platform file that allows your keyboard to replace the built-in alphanumeric "typewriter" keyboard. See the Platform File Notes documentation for more information on the RegGlobalKeyboard function.


How to Save and Restore Recognition Settings (4/9/96)

Q: Can I capture a user's recognition settings, which then may later be restored?

A: Yes, the global functions GetUserSettings, SetDefaultUserSettings and SetUserSettings allow you to manipulate recognition-related user preference data. These functions can allow an application to keep and manage recognition settings for multiple users. These functions only manage information about the recognition settings, and no other user preference settings.

    GetUserSettings()

This function returns a frame of the current user recognition settings; this frame is the argument for SetUserSettings. Do not modify the frame this function returns. Do not rely on any values, as the frame may change in future releases.

    SetDefaultUserSettings()

This function sets recognition-related user preference settings to default values.

    SetUserSettings(savedSettings)

savedSettings - Recognition preferences frame returned by GetUserSettings.
Sets user preferences for recognition as specified.


Opening the Corrector Window (3/17/97)

Q: I want the corrector window available for the user at specific times, can I open it from within my application?

A: Yes, below is the code you should use to open the corrector window. For compatibility, you should always make sure the corrector exists. The corrector itself requires that a correctable key view exists.

local correctView := GetRoot().correct;
if correctView and (GetCaretBox() or GetHiliteOffsets()) then
   correctView:Open();

Note: An older version of this Q&A (from 12/8/95) showed using GetKeyView as a test to make sure a correctable view was the key view. With the changes to the OS with the Newton 2.1 release that allow any view to be a key view, this is no longer a reliable test. The corrector will fail to open (generating a -48204 "bad path" error) if the key view does not support the caret or a selection. Calling GetCaretBox and GetHiliteOffsets is a more reliable test to see if a correctable view is available.