Finding a KeyCommand by KeyMessage

One of the Newton 2.x OS Q&As
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.


NEW: Finding a KeyCommand by KeyMessage (6/16/97)

Q: How do I find a keyCommand if all I have is the keyMessage symbol?

A: There is a global function called MatchKeyMessage that will do what you want. However, the documentation was inadvertently left out of the current version of the Newton Programmers Guide for Newton 2.1 OS. The documentation should be:
    MatchKeyMessage(startView, keyMessage)


Finds the keyCommand frame for the specified message starting with the specified view.

startView - The view from which to start searching for the message
keyMessage - A symbol for the command message that will be searched for. This must be the same message that is specified in the keyMessage slot of the keyCommand frame

return value - Either nil or a keyCommand frame

The MatchKeyMessage function searches for the message using the same lookup rules that are used when the system handles a key command.