[comp.sys.mac.programmer] Menus in DA's

adrian@torch.co.uk (Adrian Hill) (11/07/89)

I seem to be having an inordinate amount of hassle with menus in a DA, basically
I want to take the quickkeys for cut/copy/paste/quit/open etc, but I don't seem
to be able to get any reliable response from MenuKey.

Any help/pointers would be appreciated, and yes I do know I'm brain dead.


--------------------------------------------------------------------------------
Adrian Hill               * It's nice here, with a view of the trees           *
Graphics and Imaging      * Eating with a spoon, they don't give you knives    *
Torch Technology Ltd      * 'Spect you watch those trees blowing in the breeze *
Cambridge, England        * We want to see you lead a normal life              *

APPLELINK: UK0058        UUCP: adrian@torch.co.uk          PHONE: +44 223 841000
--------------------------------------------------------------------------------

oster@dewey.soe.berkeley.edu (David Phillip Oster) (11/12/89)

Key eqivalents for menu commands in desk accessories have traditionally
been hard coded into the d.a. The text in the menus is actually ignored.
Reputable d.a. authors should build a table using GetItemCmd (if you are
running on a system new enough to support that call, if not, you can do
direct access to the menu data easily enough.) so that if the user uses
some kind of tool to change your menus, your code willk respond to the
changed menus.  It is also nice to mention in your manual that you are
considerate this way.

ewing@tramp.Colorado.EDU (EWING DAVID JAMES) (11/14/89)

In article <32497@ucbvax.BERKELEY.EDU> oster@dewey.soe.berkeley.edu.UUCP (David Phillip Oster) writes:
>Key eqivalents for menu commands in desk accessories have traditionally
>been hard coded into the d.a. The text in the menus is actually ignored.

Gee, that's not what I do.  Instead I simply call MenuKey() inside my DA
when I get a key hit.  MenuKey() will return 0 if the key equivalent was in
a DA's menu,  and it calls your DA again with an accMenu control call (can
you say reentrant DA?).  If your DA has a heirarchical menu, MenuKey() will
return the ID for command key equivalents in the h-menu, and you should
handle things according to this return value.  (BTW, 32-bit QD has a bug
that doesn't allow selecting heir-menus in a DA using the mouse.  But, this
trick still works for handling command key equivalents.)  Also, Mac tech
support said they thought that this was an "interesting solution" to command
key equivalents in a DA - they had no problems with it.

Dave Ewing

ewing@tramp.colorado.edu  (128.138.238.33)
..!hplabs!boulder!onecom!tyvax!iftech!dave (My Mac IIx running uupc & MacOS!)
AppleLink: D2408	  (D2408@applelink.apple.com)