InsertMenuItem

To insert a item into a menu, use the InsertMenuItem method.

InsertMenuItem theMenu as MenuHandle, itemText as String, afterItem as Integer

theMenu Handle of a menu in which to insert an item.

itemText Text to put in the menu (Max 255 chars), see more bellow.

afterItem 0=before first; else=where to put the item.


itemText (more info):
The toolbox makes InsertMenuItem quite flexible via the itemText parameter. Multiple itmes can be inserted with one command by seperating items in the itemText by semi-colons (;), the following list special metacharacters that may be embended in itemText:


Char Dec Description
; 59 Item seperator

Return 13 Item seperator

^ 94 Next character specifies an icon (its resorce ID is char ASCII value+208)

! 33 Next char is "mark"; e.g. 030 = "Ã" or when next char is 0x1B, this is a submenu ID.

< 60 Next char specified style (B,I,U,O or S).

/ 47 Next char is a command key equivalent ...OR... when next char is 0x1B, this is a submenu title.

( 40 This item is disabled (dimmed)

- 45 (when firs char) "item" is a dotted line, normally used with "C"; e.g. (-

Supported platforms:
* MacOS PPC
* MacOS Carbon
* MacOS 68k

Unsupported platforms:
* Windows x86