Tools: MPW
Advanced Search
Apple Developer Connection
Member Login Log In | Not a Member? Support

MPW Command Reference


Appendix C (continued)

Menu Characters

-  Add a separator to a menu

The hyphen is used with the AddMenu command to add a horizontal line, or separator, to a menu. To see an example of a separator in a menu, open the MPW Shell File menu. It contains separators that separate the menu into four parts.

You should always specify separators as disabled menu items. To disable the separator, add a ( character before the hyphen in the menu, as in

AddMenu Diner '(-' '# no command'

/c  Assign a keystroke to a menu item

The / operator is used with the AddMenu command to assign a Command-key combination to a menu item. Once the key combination is assigned, you can type it to execute the menu item. Note that you add the character immediately after the / character in the command; you do not need to designate the Command key. The Command-key equivalent appears to the right of the menu item.

For example, you could enter

AddMenu Diner 'Delete This Menu/D' 'DeleteMenu Diner'

to add the menu item Delete This Menu, with its Command-key equivalent Command-D, to the Diner menu.

!c  Mark a menu item with a character

The ! operator is used with the AddMenu command to mark a menu item with a character. The character is placed to the left of the menu item. The character that follows the operator is the character you want to appear in the menu. For example, you can mark a menu item with a command like this one:

AddMenu Diner "Eat at Joe∂'s!√" ∂
  'Alert "... and you'∂''ll be sorry!" '

In this case, the menu item Eat at Joe's has the √ character placed before it.

(  Disable a menu item

The ( character is used with the AddMenu command to disable and dim an item in a menu. To see an example of dimmed menu items, open the MPW Shell File menu. Some menu items are dimmed, indicating that you cannot select them.

To disable a menu item, place the ( character at the beginning of the menu item in the AddMenu command, like this:

AddMenu Diner '(Delete This Menu' ∂
  'Alert "you can'∂''t do that!" '

The item Delete This Menu is added to the menu, but it is dimmed so that it can't be chosen.

^n  Mark a menu item with an icon

The ^ character is used with the AddMenu command to add an icon to a menu item. The number following the ^ character in the command is the number of the icon in the MPW Shell resource fork.

For example, the command

AddMenu Diner "Joe's Bar & Grill"^1 'Alert "Bonfire!"'

adds the item Joe's Bar & Grill to the Joe menu and places icon number 1 to the left of the menu item.

<c  Set the character style of a menu item

The < character can be used with certain other characters following it in the AddMenu command to set the character style of a menu item. You can add items to a menu in plain text or in bold, italic, underline, outline, or shadow fonts. The characters you use to set the style of menu items are listed below:

<B
<I
<U
<O
<S

Bold
Italic
Underline
Outline
Shadow

For example, you could enter

AddMenu Diner "Joe's Menu <B<S<O" 'Alert "High cholesterol!"'

which puts the item Joe's Menu on the menu in bold, shadowed, and outlined text.

 
 


Last Updated July 2000