Applications can now create menus with checked items (both standard and radio-style), as well as nested submenus, through the addition of a new optional parameter (itemid) and several new parameter flags:
xcall AUI, AUI_MENU, opcode, menuid, mnutxt, mstate, mtype, cmd, func, mstatus {,dlgid {,itemid}}
The new parameter, itemid, may be used to attach a unique numeric ID to any menu item, in the range of 1000-32767. The id is optional for the existing menu item types, but necessary for submenus and checked menu items (in order to more easily reference them for querying, setting, or adding nested items to).
New mtype flags:
MBF_CHKMNU (&h0004) - A checked menu item
MBF_RADIOMNU (&h0008) - A radio-style checked menu item
New mstate flags:
MBST_CHECKED (&h10000000) - Item is checked
MBST_HILITE (&h20000000) - Item is hilighted
MBST_DEFAULT (&h40000000) - Item is the default option
Setting the checked state under application control: Checkable items start out unchecked by default, unless you specify the MBST_CHECKED state flag when adding the item. Applications may also change the checked state of an item using opcode MNUOP_STA, identifying the item via its parent menu id (menuid) and its item id (itemid), and setting or clearing the MBST_CHECKED flag in mstate.
Setting the checked state under user control: The checked state is automatically toggled whenever the user clicks on a checkable menu item. Checkable items can also act like other menu items (depending on the MBF_KBD, MBF_CMDLIN, and MBF_SHLEXC flags, and the mnutxt contents). If you want the application to be notified whenever the checked state is changed by the user, specify the MBF_KBD flag and set mnutxt to a virtual symbolic key string (e.g. "VK_xF1001"). Otherwise, the application will be ignorant of changes to the checked state unless or until it queries the item explicitly (see below).
Querying the checked state: opcode MNUOP_CHK now returns the current state of a menu item in the mstatus parameter (using the MBST_xxxx flags). Currently you must query the items individually, specifying the menuid and itemid.
Hilighting: The MBST_HILITE state adds some kind of visual highlighting to the item. Under Vista, the effect is quite subtle, and basically the same as what you get when the mouse hovers over an item.
Submenus: To create a submenu, use the MBF_SUBMNU flag and specify a menuid other than 0. (Submenus whose parent menuid is 0 are top-level drop-down menus.) To create the items within the submenu, set the menuid to match the itemid of the submenu itself.
The new EXLIB sample program ASMNU2 illustrates all of these capabilities.