Skip to Content
0
Former Member
May 05, 2008 at 05:25 PM

Adding an image to a new Menu Item

916 Views

I have added an new menu item to the Main “Modules” meny and I would like to add an icon or image to the new entry like the ones used by B1 on the same menu.

The following code works to add a menu item to the “Modules” menu.

'// Create Menu item

oCreationPackage = oApplication.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_MenuCreationParams)

oCreationPackage.Type = SAPbouiCOM.BoMenuType.mt_POPUP

oCreationPackage.UniqueID = "LSMAin"

oCreationPackage.String = "SC1 - Shopping Center Management"

oCreationPackage.Position = 99

' Add the new menu item

oModulesSubMenus.AddEx(oCreationPackage)

The following code fails. Note that I have tried to add an image to the menu item.

'// Create Menu item

oCreationPackage = oApplication.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_MenuCreationParams)

oCreationPackage.Type = SAPbouiCOM.BoMenuType.mt_POPUP

oCreationPackage.UniqueID = "LSMAin"

oCreationPackage.String = "SC1 - Shopping Center Management"

oCreationPackage.Position = 99

sFullPath = sPath & "bcg-0449-sc1_icon.bmp"

oCreationPackage.Image = sFullPath

' Add the new menu item

oModulesSubMenus.AddEx(oCreationPackage)

The error is:

Menu - Addition has failed [66000-5]

I have comfirmed that the path to the bit map file is correct by opening it directly with the File object. I have also tried using an “ico” type file with the same result. The file that I am using is 26 x 18 pixels .bmp as specified in the SDK documentation.

What am I doing wrong? Thanks for your help.

Mel