Here is how you create a menu item with two sub items attached:
struct MsgPort * port;
struct AppMenuItem * item;
struct AppMenuItem * sub1;
struct AppMenuItem * sub2;
ULONG key;
/* IMPORTANT: you *must* initialize the key to zero
* for backwards compatibility!
*/
key = 0;
item = AddAppMenuItem(0,0,"AppMenu item with two sub items",port,
TAG_DONE);
/* IMPORTANT: always check for the key value to be non-zero! */
if(key != 0 && item != NULL)
{
sub1 = AddAppMenuItem(0,0,"Sub item #1",port,
TAG_DONE);
sub2 = AddAppMenuItem(0,0,"Sub item #2",port,
TAG_DONE);
/* ... do something useful with the menus ... */
RemoveAppMenuItem(sub1);
RemoveAppMenuItem(sub2);
}
RemoveAppMenuItem(item);