Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

how to handle Right click event

Hi,

Iam new to SAP B1 2007.I need to delete a row in a matrix using right click.

I have a main class gets called where I have created Menus and submenus.

I also tried creating the menu for right click with the below code ,given by SDK.But,second time when I build it shows the unique ID exist already.Iam unable to call this method in the constructor as I do for other menus,because the parameters are different for my class constructor.

This is code for Right click Menu creation.

Private Sub SBO_Application_RightClickEvent(ByRef eventInfo As SAPbouiCOM.ContextMenuInfo, ByRef BubbleEvent As Boolean) Handles SBO_Application.RightClickEvent

If eventInfo.FormUID = "RightClk" Then

If (eventInfo.BeforeAction = True) Then

Dim oMenuItem As SAPbouiCOM.MenuItem

Dim oMenus As SAPbouiCOM.Menus

Try

Dim oCreationPackage As SAPbouiCOM.MenuCreationParams

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

oCreationPackage.Type = SAPbouiCOM.BoMenuType.mt_STRING

oCreationPackage.UniqueID = "OnlyOnRC"

oCreationPackage.String = "Only On Right Click"

oCreationPackage.Enabled = True

oMenuItem = SBO_Application.Menus.Item("1280") 'Data'

oMenus = oMenuItem.SubMenus

oMenus.AddEx(oCreationPackage)

Catch ex As Exception

MessageBox.Show(ex.Message)

End Try

Else

Dim oMenuItem As SAPbouiCOM.MenuItem

Dim oMenus As SAPbouiCOM.Menus

Try

SBO_Application.Menus.RemoveEx("OnlyOnRC")

Catch ex As Exception

MessageBox.Show(ex.Message)

End Try

End If

End If

End Sub

Now,Consider I have created the menu on right click and I get the menu 'Only On Right Click'.

I have a seperate class for writing the events of the screen and usually I call this event method in my ItemEvent of the main class.

Having only (eventinfo,bubbleevent ) ,as my parameter I am wondering how do I catch the 'Only On Right Click' menu in my right click in the Item Event and add the delete row code.

Thanks In Advance

Former Member
Not what you were looking for? View more on this topic or Ask a question