Adding Menu on Right Click failes on sales oder form
Hi you all
I want to add for sales oder form on right click some menu items so the user can navigate to different user forms.
I catch the RightMouse Before action Event and I'm
adding menues for the menue groupe "Goto". When the sales order form is in Add Mode right after the form is launched then my menus are nicely added I can see them.
Changing the sales order form mode to OK, after a Find, and I go again for the right click then my added menu items are not there anymore. First I thougt SBO is overwriting the menue for some reason and I did again adding them. It did not work. It seems like SDK adds the menues but they will not be visible.
I tried all kind of work arounds to make it working but I failed.
Has anyone an idea what I do wrong ?
I use this code to add menues:
Private Sub XX_AddMenuToMenuGroup(ByVal sbo_mnusv As SAPbouiCOM.Menus, _
ByVal szvMenuKey As String, _
ByVal szvMenuCaption As String, _
ByVal sbo_emtv As SAPbouiCOM.BoMenuType)
Dim mcp_sbo As SAPbouiCOM.MenuCreationParams
Set mcp_sbo = sbo_ax.CreateObject(Type:=cot_MenuCreationParams)
szIconFileSpec = upx.IconPath & _
szxDELIMETER_CHAR & _
.String = szvMenuCaption
.UniqueID = szvMenuKey
.Type = sbo_emtv
.Enabled = True
.Position = sbo_mnusv.Count
.Image = szIconFileSpec
Paul Buterbaugh replied
This sounds similar to something I had an issue with. The menu creation may be throwing an exception because it already sees the UID. The menus disapearing seems to be related to the FormMode Change.
Have you tried a "Try...Catch..End Try" Loop. If the creation fails, try again with a different UID. Such as adding a counter at the end for each attempt.
Hope this helps.