THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 31/07/2012 at 03:46, xxxxxxxx wrote:
Originally posted by xxxxxxxx
The problem is I don't know how to go one step deeper and get the individual items inside of the File menu. Then add your own item to the list.
I can only get TO the File menu..which is a submenu of M_EDITOR.
To go one step deeper you have to browse the submenu container (when it's a MENURESOURCE_SUBMENU) and you get the individual items that can be: MENURESOURCE_SEPERATOR, MENURESOURCE_COMMAND or MENURESOURCE_SUBMENU.
Here is how to add new items in the "File" menu:
if (!fileMenu) return; // This is the container you get with MENURESOURCE_SUBMENU
LONG sep = 0;
bc = fileMenu->GetContainer();
BrowseContainer browseFileMenu(bc);
while (browseFileMenu.GetNext(&id,&dat))
{
if(id==MENURESOURCE_SEPERATOR)
{
sep++; // Count number of seperator to insert our items after
if (sep==4)
{
GeData item;
item.SetString(String("PLUGIN_CMD_1000472")); // Set data with ActiveObject command plugin ID string
GeData *last = bc->InsDataAfter(MENURESOURCE_COMMAND,item,dat); // Add ActiveObject command to menu
item.SetLong(TRUE); // Set data to TRUE to enable separator
bc->InsDataAfter(MENURESOURCE_SEPERATOR,item,last); // Add separator item
break;
}
}
}
Originally posted by xxxxxxxx
Once you have that new menu. I have no idea how to add your plugin as a child of that custom menu.
The above example illustrates this. To add your plugin as a menu item you just need to insert a MENURESOURCE_COMMAND with a string formated "PLUGIN_CMD_YOURPLUGINID".