on 10-01-2008 3:00 PM
HI,
How to create folder in Menu
Like In Production Menu we have productionReport.How is it possible?Using Vb.Net
Hi,
As complement of Vitor said, you can create your menu like this :
SAPbouiCOM.Menus oMenus;
SAPbouiCOM.MenuItem oMenuItem;
SAPbouiCOM.MenuCreationParams oMenuCreationParams;
string sPath = "";
try
{
sPath = System.Windows.Forms.Application.StartupPath;
oMenuCreationParams = (SAPbouiCOM.MenuCreationParams)SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_MenuCreationParams);
oMenuCreationParams.Type = SAPbouiCOM.BoMenuType.mt_POPUP;
oMenuCreationParams.Image = sPath + "
IMG127.BMP";
oMenuCreationParams.Position = 6;
oMenuCreationParams.UniqueID = "IFC_MENU_COM";
oMenuCreationParams.String = ChangeLanguage.GetName_For_Menu(SBO_Application.Language); ;
oMenuItem = SBO_Application.Menus.Item("43520");
oMenus = oMenuItem.SubMenus;
if(SBO_Application.Menus.Exists("IFC_MENU_COM") == true)
return;
oMenuItem = oMenus.AddEx(oMenuCreationParams);
System.Runtime.InteropServices.Marshal.ReleaseComObject(oMenuCreationParams);
oMenuCreationParams = null;
oMenuCreationParams = (SAPbouiCOM.MenuCreationParams)SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_MenuCreationParams);
oMenuCreationParams.Type = SAPbouiCOM.BoMenuType.mt_STRING;
oMenuCreationParams.Image = "";
oMenuCreationParams.Position = 1;
oMenuCreationParams.UniqueID = "IFC_COM";
oMenuCreationParams.String = ChangeLanguage.GetName_For_SubMenu(SBO_Application.Language, "1");
oMenus = oMenuItem.SubMenus;
oMenus.AddEx(oMenuCreationParams);
oMenuCreationParams = (SAPbouiCOM.MenuCreationParams)SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_MenuCreationParams);
oMenuCreationParams.Type = SAPbouiCOM.BoMenuType.mt_STRING;
oMenuCreationParams.Image = "";
oMenuCreationParams.Position = 2;
oMenuCreationParams.UniqueID = "IFC_CALC";
oMenuCreationParams.String = ChangeLanguage.GetName_For_SubMenu(SBO_Application.Language, "2");
oMenus.AddEx(oMenuCreationParams);
oMenuCreationParams = (SAPbouiCOM.MenuCreationParams)SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_MenuCreationParams);
oMenuCreationParams.Type = SAPbouiCOM.BoMenuType.mt_STRING;
oMenuCreationParams.Image = "";
oMenuCreationParams.Position = 3;
oMenuCreationParams.UniqueID = "IFC_BULL";
oMenuCreationParams.String = ChangeLanguage.GetName_For_SubMenu(SBO_Application.Language, "3");
oMenus.AddEx(oMenuCreationParams);
}
Hope it's help you.
Regards
Michael
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Use the following function to import the menu from XML
Public Function AddMenus(ByRef oCompany As SAPbobsCOM.Company, ByRef oApplication As SAPbouiCOM.Application) As Boolean
Dim oForm As SAPbouiCOM.Form = Nothing
Dim oXMLDoc As System.Xml.XmlDocument = New Xml.XmlDocument
AddMenus = False
Try
oForm = oApplication.Forms.GetFormByTypeAndCount(169, 1) '// Apanhar a referência do formulário do menu principal
oForm.Freeze(True)
oXMLDoc.load(sPath & "menusAdd_.xml")
oApplication.LoadBatchActions(oXMLDoc.InnerXml)
' // Set the icon for the menu folder
Dim oMenuItem As SAPbouiCOM.MenuItem = oApplication.Menus.Item(oXMLDoc.SelectSingleNode("Application/Menus/action/Menu/@UniqueID").Value)
oMenuItem.Image = sPath & "orange.bmp"
AddMenus = True
Catch ex As Exception
oApplication.MessageBox("AddMenus(): " & oCompany.GetLastErrorCode.ToString & ", " & ex.Message)
Finally
oForm.Freeze(False)
oForm.Update()
End Try
End Function
Here is a samples of the Menu XML File
<Application>
<Menus>
<action type="add">
<Menu Checked="0"
Enabled="1"
FatherUID="43520"
String="Orange.One"
Type="2"
UniqueID="ADAT_OONE">
<Menus>
<action type="add">
<Menu Checked="0"
Enabled="1"
FatherUID="ADAT_OONE"
String="Nota de Recepção"
Type="1"
UniqueID="ADAT_OONE_mnuNR"></Menu>
</action>
</Menus>
</Menu>
</action>
</Menus>
</Application>
Remarks:
- When Type="2", the menu item is a Folder
- When Type="1", the menu item is a String
- When Type="3", the menu item is a Separator
Regards,
Vítor Vieira
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
101 | |
12 | |
11 | |
6 | |
6 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.