cancel
Showing results for 
Search instead for 
Did you mean: 

UI: Adding menu options to the Command Centre

Former Member
0 Kudos

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?

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

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

Former Member
0 Kudos

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.

Former Member
0 Kudos

This sample code will add a new menu with one menu item to the top level menu after the Help menu, will it not?

You will first have to find out which menu the main menu (Command Center) is and instanciate the menu collection to this.

Isn't this correct?

Former Member
0 Kudos

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

Former Member
0 Kudos

One more thing,

The Manu functionality is under revising - meaning that this will be irrelevant for version 6.7.

Please refer to 6.7 documentation, once it will be release.

Regards,

Yaniv G.

SDK Consultant,

SAP Manage Israel

Former Member
0 Kudos

Thanks for your suggestions, but it not the main menu that interests me, it's the command centre. I have saved the command centre form into XML but that has not helped me trying to figure out how to add menu items to the command centre.

StephanPutro
Explorer
0 Kudos

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

Former Member
0 Kudos

OK thanks for that!

Former Member
0 Kudos

But, who can tell me kindly how to specify the MenuItem's Icons as the SBO's done?