Added May 2012
In addition to menu items that send keyboard sequences (MBF_KBD), execute commands (MBF_CMDLIN) or launch object handlers (MBF_SHLEXC), typically via Virtual Key Symbolic Names, A-Shell and ATE come with a set of built-in or internal menus (e.g. File > Load Setting) that simply send their ID's to A-Shell, which has its own internal logic to deal with them. It would be pointless to add new menu items of this type, since A-Shell wouldn't recognize them. But, you can use the internal ID as a convenient and robust way to reference the built-in menus for purposes such as deleting, disabling, and/or later re-adding them.
The internal menu IDs are defined via IDM_xxx symbols in ashell.def, for which see the following section Internal Menu Identifiers.
Example 1: Deleting an internal menu
The most straightforward way to delete a built-in (but not top level) menu by its internal ID is by setting both the menuid and mnutxt parameters to "", the Mtype parameter to MBF_MENUID, and putting the internal menu ID in the Itemid parameter. (The mstate, cmd and func parameters are irrelevant when deleting, and the dlgid parameter isn't relevant for built-in menus.) For example, to delete the Edit > Copy menu:
menuid$ = ""
mnutxt$ = ""
mtype = MBF_MENUID
xcall AUI, AUI_MENU, MNUOP_DEL, menuid$, mnutxt$, mstate, mtype, cmd$, func$, mstatus, 0, IDM_COPY
Example 2: Alternate syntax for deleting an internal menu
And alternate syntax sets the Menuid parameter to "*", the Mnutxt parameter to the string representation of the internal ID, and the Mtype parameter to MBF_MENUID. For example, to delete the File > Save menu:
menuid$ = "*"
mnutxt$ = str(IDM_SAVE)
mtype = MBF_MENUID
xcall AUI, AUI_MENU, MNUOP_DEL, menuid$, mnutxt$, mstate, mtype, cmd$, func$, mstatus
This example deletes File > Exit, and adds a "New Exit" option to the Settings menu which performs the same function as the original File > Exit:
mnu'exit'id$ = str(IDM_EXIT) ! internal ID of File > Exit
xcall AUI, AUI_MENU, MNUOP_DEL, 1, mnu'exit'id$, 0, 0, "", "", mstatus
xcall AUI, AUI_MENU, MNUOP_ADD, 3, "New Exit", MBST_ENABLE, MBF_MENUID, mnu'exit'id$, "", mstatus
Note that the Menuid parameters 1 and 3 reference the top level File and Settings menu by position.
Example 3: Moving / renaming a built-in menu item
This example deletes File > Exit, and adds a "New Exit" option to the Settings menu which performs the same function as the original File > Exit:
mnu'exit'id$ = str(IDM_EXIT) ! internal ID of File > Exit
xcall AUI, AUI_MENU, MNUOP_DEL, 1, mnu'exit'id$, 0, 0, "", "", mstatus
xcall AUI, AUI_MENU, MNUOP_ADD, 3, "New Exit", MBST_ENABLE, MBF_MENUID, mnu'exit'id$, "", mstatus
Note that the Menuid parameters 1 and 3 reference the top level File and Settings menu by position.
Example 4: Deleting a Top Level Menu Item
Top level menu items (e.g. File, Edit, Settings, Help), unfortunately have no internal IDs, so they can only be deleted by position (first position = 0). The rest of the parameters have no particular significance here. For example, to delete the Settings menu (position 2):
menuid$ = "" ! must be "" or 0 to indicate top level
mnutxt$ = "2" ! position of Settings menu (2 = 3rd item)
xcall AUI, AUI_MENU, MNUOP_DEL, menuid$, mnutxt$, 0, 0, "", "", mstatus
Note that after deleting any menu item, the items following it are shifted up in position. So in this case, if we executed the above program sequence again, we would delete whatever menu was originally following the Settings menu (i.e. Help). Also note that deleting any menu item automatically deletes any and all sub-items beneath it. So the above sequence would delete (and clean up) all of the sub, sub-sub, etc. items beneath the Settings menu.