[comp.sys.mac.programmer] Menu command key

mmoss@csws10.ic.sunysb.edu (Matthew D Moss) (12/10/90)

Sorry, my system won't let me 'R'espond to any postings, so I
can't include the original question, nor do I remember the
person's name.

The basic question was how to make the menu of a DA accept
COMMAND-W as Close in the File menu. The peron who asked had
gone into the program's resources with ResEdit, but had no
luck after changing the resource.

My answer :

If you change the resource, all that will do is change it's
appearance when the menu is drawn onscreen.

To make the DA (or any program) accept a change of Command
key, you must change the source code of the program. Basically,
write in a event handler routine that watches for keyDown
events, then use a switch to catch any W's, and check to see
if the Command key was down (some other function).

At least, that's what I know. I've only begun programming, so
I may be wrong.

----------------

Matthew Moss
mmoss@libserv1.ic.sunysb.edu

"To spam or not to spam, that is the lunchmeat!" - He who would be me

----------------

pepke@gw.scri.fsu.edu (Eric Pepke) (12/12/90)

In article <1990Dec10.044033.19193@sbcs.sunysb.edu> 
mmoss@csws10.ic.sunysb.edu (Matthew D Moss) writes:
> To make the DA (or any program) accept a change of Command
> key, you must change the source code of the program.

No you don't, at least for applications.  A correct program determines 
whether a keypress corresponds to a menu item by calling the MenuKey 
routine.  This routine does a search of the existing menus on the screen 
and returns the first item it finds with that command key equivalent.

Eric Pepke                                    INTERNET: pepke@gw.scri.fsu.edu
Supercomputer Computations Research Institute MFENET:   pepke@fsu
Florida State University                      SPAN:     scri::pepke
Tallahassee, FL 32306-4052                    BITNET:   pepke@fsu

Disclaimer: My employers seldom even LISTEN to my opinions.
Meta-disclaimer: Any society that needs disclaimers has too many lawyers.