on 05-12-2004 11:48 PM
I would like to add more menu items/options to the Business One command centre. I have looked at the XML code for this form and it looks very complex. Is there a way to easily add menu items to the command centre?
Hello Lita,
The possibility to add a graphic/icon to a menu item is currentlyu planned for Version 6.7.
Regards,
Lisa Mulchinock
SAP SDK Support Consultant
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Adding Menu items to the main menu (Command Centre) can be done easily using the SAP Business One SDK UI API.
Here is a VB sample code that describes how easy it is to add menu items via UI API:
Set oMenus = SBO_Application.Menus
Set oMenuItem = oMenus.Add("MyMenu1", "User Forms", mt_POPUP, oMenus.Count)
Set oMenuItem = oMenus.Add("MyMenu2", "User Form", mt_STRING, 0)
Regards,
Yaniv G.
SDK Consultant,
SAP Manage Israel.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi again,
You are very much correct. the purpose was to show how easy and simple it is.
Here is The full function of the Sample project that adds a simple 'My Menu' with two siblings as shown:
sorry for the indenting mess ...
My Menus
...My Menu 1
...My Menu 2
Public Sub Execute()
'//******************************************************************
'// add a separator, a pop-up menu item and a string menu items
'//******************************************************************
Dim oMenus As SAPbouiCOM.Menus
Dim oMenuItem As SAPbouiCOM.MenuItem
Dim i As Long '// to be used as counter
'// Get the menus collection from the application
Set oMenus = SBO_Application.Menus
'// find the place in wich you want to add your menu item
'// in this example I chose to add my menu item under
'// Module.
For i = 0 To oMenus.Count - 1
Set oMenuItem = oMenus.Item(i)
If oMenuItem.String = "&Module" Then
GoTo Continue
End If
Next i
Continue:
If oMenuItem.String = "&Module" Then
'// just to be on the safe side
'// Get the menu collection of the Module section
Set oMenus = oMenuItem.SubMenus
s
If Not (oMenus.Item(oMenus.Count - 1).String = "My Menus") Then
'// don't try to add the menu items again
'// in case Add On was killed and raised again
'// Add a separator at the end of the collection
'// I am using the oMenus.Count property to set the function after parameter
oMenus.Add "MyMenu0", "", mt_SEPERATOR, oMenus.Count
'// Add a pop-up menu item
Set oMenuItem = oMenus.Add("MyMenu1", "My Menus", mt_POPUP, oMenus.Count)
'// Get the menu collection of the newly added pop-up item
Set oMenus = oMenuItem.SubMenus
'// add a menu item to the pop-up item
oMenus.Add "MyMenu2", "My Menu 1", mt_STRING, 0
'// add a menu item to the pop-up item
oMenus.Add "MyMenu3", "My Menu 2", mt_STRING, 0
End If
Else
SBO_Application.MessageBox "Failed adding menu items" _
& vbNewLine & "Requested position doesn't exist"
End If
'// See SBO_Application_MenuEvent on how to catch the Event sent by
'// the new menu item
End Sub
Hi!
The "Command Centre" are the items of the Submenu "Module". When you add an item to this Submenu, it will apear automatic in command centre.
hth, Stephan
VB6 Sample:
Sub AddMenuItem()
Dim oMenuModule As SAPbouiCOM.MenuItem
Dim oMenus As SAPbouiCOM.Menus
Dim i As Long
'// Menu-Collection
Set oMenus = SBOApplication.Menus
'// search for submenu &Module
For i = 0 To oMenus.Count - 1
Set oMenuModule = oMenus.Item(i)
If oMenuModule.String = "&Module" Then
Exit For
End If
Next i
Set oMenus = oMenuModule.SubMenus
oMenus.Add "mnuMyMenu", "New Menu Item", mt_STRING, 0
Set oMenus = Nothing
Set oMenuModule = Nothing
End Sub
User | Count |
---|---|
99 | |
11 | |
11 | |
6 | |
6 | |
4 | |
4 | |
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.