[comp.sys.mac.programmer] Shift-Command-Key in Menus

bordier@imag.imag.fr (Jerome Bordier) (08/28/90)

MacWrite II has Shift-Command-Keys in its Menus (so called "keyboard
equivalents"). Shift modifier is symbolized by a little up arrow on the
left of the command (clover) symbol.
I would like to use this arrow symbol in the menus of my application.
Anybody know how make to appear this "shift" symbol in menu items ?

Thank you in advance.

N.B. MacWrite is a registred trademark of Claris Inc.

-- 
Jerome BORDIER 	Laboratoire de Structures Discretes et de Didactique
                IMAG B.P. 53 X  38041 GRENOBLE Cedex   FRANCE
TEL: (33) 76 51 45 53  FAX: (33) 76 51 45 55
INTERNET: bordier@imag.Fr       UUCP: bordier@imag (uunet.uu.net!imag!bordier)

mkelly@cs.uoregon.edu (Michael A. Kelly) (08/31/90)

In article <12236@imag.imag.fr> bordier@imag.fr (Jerome Bordier) writes:
>MacWrite II has Shift-Command-Keys in its Menus (so called "keyboard
>equivalents"). Shift modifier is symbolized by a little up arrow on the
>left of the command (clover) symbol.
>I would like to use this arrow symbol in the menus of my application.
>Anybody know how make to appear this "shift" symbol in menu items ?


I am also interested in the answer to this question....


Mike.
--
Michael A. Kelly
mkelly@cs.uoregon.edu

brendan@claris.com (Brendan McCarthy) (08/31/90)

In article <12236@imag.imag.fr> bordier@imag.fr (Jerome Bordier) writes:
>MacWrite II has Shift-Command-Keys in its Menus (so called "keyboard
>equivalents"). Shift modifier is symbolized by a little up arrow on the
>left of the command (clover) symbol.
>I would like to use this arrow symbol in the menus of my application.
>Anybody know how make to appear this "shift" symbol in menu items ?

Sure, all you have to do is write your own MDEF.  Then you need to rewrite
MenuKey to handle the additional modifier keys.  Remember, your MDEF must
check which system version is running in order to properly space command
key equivilents (2 extra pixels for 6.0.3, I believe).  

Brendan
brendan@claris.com

  

bordier@imag.imag.fr (Jerome Bordier) (09/03/90)

Here is a summary of both responses I have received and my personal
investigations.

As Brendan McCarthy says, the best solution is writing your own MDEF :
" Remember, your MDEF must
check which system version is running in order to properly space command
key equivalents (2 extra pixels for 6.0.3, I believe). "
MacWrite II uses a pseudo-icon definition : a special icon number is stored
in the resource for each item which has the shift-command-key equivalent
(it is easy to see that with ResEdit or REdit). So your MDEF has to detect
this special number in the menu data and draw the arrow instead of an icon.

There is yet another way with less programming effort (see Inside Macintosh,
function MenuSelect). You can store in the global variables MenuHook and
MBarHook the adresses of routines that will be called during Menuselect.
You have to write two routines, say my_MBarHook and my_MenuHook.
MBarHook is passed (as parameter) a pointer to the Menu rectangle.
So my_MenuHook can calculate menu item rectangle coordinates and draw
the little arrow in front of the clover symbol. Your MenuHook must check
two cases : disabled item or menu and highlighted item, and draw with the
adequate pen pattern (grey, white or black).
You can use the pseudo icon method to parametrize the hook (first detect
the menu items, second set icon number to zero in the menu data). 

Bis repetita : MacWrite is a registered trademark of Claris inc.
-- 
Jerome BORDIER 	Laboratoire de Structures Discretes et de Didactique
                IMAG B.P. 53 X  38041 GRENOBLE Cedex   FRANCE
TEL: (33) 76 51 45 53  FAX: (33) 76 51 45 55
INTERNET: bordier@imag.Fr       UUCP: bordier@imag (uunet.uu.net!imag!bordier)