Hi Mark,
For PopUp Menu, you need to use
oCreationPackage.Type = SAPbouiCOM.BoMenuType.mt_POPUP;
Once you create it, the POPUP Event will be catched automatically by SAP. Also provide the position, where you want to show it.
I use following method to do it:
public void AddMenu(string ParentMenu, BoMenuType MenuType, string UniqueID, string Name, int Position, [Optional, DefaultParameterValue(null)] string ImagePath)
{
try
{
SAPbouiCOM.MenuItem oMenuItem = default(SAPbouiCOM.MenuItem);
SAPbouiCOM.Menus oMenus = default(SAPbouiCOM.Menus);
SAPbouiCOM.MenuCreationParams oCreationPackage = default(SAPbouiCOM.MenuCreationParams);
try
{
oMenuItem = SBO_Value.SBO_Application.Menus.Item(UniqueID);
return;
}
catch
{
}
oCreationPackage = (SAPbouiCOM.MenuCreationParams)SBO_Value.SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_MenuCreationParams);
oMenuItem = SBO_Value.SBO_Application.Menus.Item(ParentMenu);
oMenus = oMenuItem.SubMenus;
oCreationPackage.Type = MenuType;
oCreationPackage.UniqueID = UniqueID;
oCreationPackage.String = Name;
oCreationPackage.Enabled = true;
oCreationPackage.Position = Position;
oCreationPackage.Image = ImagePath;
oMenus.AddEx(oCreationPackage);
}
catch (Exception ex)
{
ShowMessage(ex.Message, BoStatusBarMessageType.smt_Error);
}
}
To call this method:
AddMenu("8192", SAPbouiCOM.BoMenuType.mt_POPUP, "MENUID", "Add-On Database Settings", 9, null);
Hope it helps.
Thanks & Regards
Ankit Chauhan