cancel
Showing results for 
Search instead for 
Did you mean: 

Right-Click Custom Menu

Former Member
0 Kudos

Good Day

Experts:

Well, I have revisited my old friend the Right-Click custom menu set-up. After today I am at "witts" end andnot sure what to do. Here is what I have going.

1)Form with multiple Tabs

2)2 of the Tabs need seperate right-click menus and the rest need nothing

I will attach the code at the end. The toggling back and forth between Tabs produces the correct corresponding menu. All is great. However, as soon as I execute one of the menu selections, which happens to run correctly, the right-click

menus stop toggling correctly between the Tabs. So, I put a breakpoint in the right-click event routine and it never gets in there.

So, here is what I have in the right-click event routine. Hopefully I am missing something that you all can see.

Thanks Ed

Public Sub RightClickEvent(ByRef eventInfo As SAPbouiCOM.ContextMenuInfo, ByRef BubbleEvent As Boolean)

Try

If (eventInfo.BeforeAction = True) Then

Select Case eventInfo.ItemUID

<b>Case "mtxOper"</b>

If g_B1Connection.Application.Menus.Exists("Update Material Row") Then

g_B1Connection.Application.Menus.RemoveEx("Update Material Row")

End If

If g_B1Connection.Application.Menus.Exists("Add Material Row") Then

g_B1Connection.Application.Menus.RemoveEx("Add Material Row")

End If

If g_B1Connection.Application.Menus.Exists("Delete Material Row") Then

g_B1Connection.Application.Menus.RemoveEx("Delete Material Row")

End If

Dim oCreationPackage As SAPbouiCOM.MenuCreationParams

oCreationPackage = g_B1Connection.Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_MenuCreationParams)

oCreationPackage.Type = SAPbouiCOM.BoMenuType.mt_STRING

oCreationPackage.UniqueID = "Update Operation Row"

oCreationPackage.String = "Update Operation Row"

oCreationPackage.Position = 1

WOForm.Menu.AddEx(oCreationPackage)

oCreationPackage.Type = SAPbouiCOM.BoMenuType.mt_STRING

oCreationPackage.UniqueID = "Add Operation Row"

oCreationPackage.String = "Add Operation Row"

oCreationPackage.Position = 2

WOForm.Menu.AddEx(oCreationPackage)

oCreationPackage.Type = SAPbouiCOM.BoMenuType.mt_STRING

oCreationPackage.UniqueID = "Delete Operation Row"

oCreationPackage.String = "Delete Operation Row"

oCreationPackage.Position = 3

WOForm.Menu.AddEx(oCreationPackage)

<b> Case "mtxMatl"</b>

Dim oCreationPackage As SAPbouiCOM.MenuCreationParams

oCreationPackage = g_B1Connection.Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_MenuCreationParams)

oCreationPackage.Type = SAPbouiCOM.BoMenuType.mt_STRING

oCreationPackage.UniqueID = "Update Material Row"

oCreationPackage.String = "Update Material Row"

oCreationPackage.Position = 1

WOForm.Menu.AddEx(oCreationPackage)

oCreationPackage.Type = SAPbouiCOM.BoMenuType.mt_STRING

oCreationPackage.UniqueID = "Add Material Row"

oCreationPackage.String = "Add Material Row"

oCreationPackage.Position = 2

WOForm.Menu.AddEx(oCreationPackage)

oCreationPackage.Type = SAPbouiCOM.BoMenuType.mt_STRING

oCreationPackage.UniqueID = "Delete Material Row"

oCreationPackage.String = "Delete Material Row"

oCreationPackage.Position = 3

WOForm.Menu.AddEx(oCreationPackage)

<b>Case Else</b>

If g_B1Connection.Application.Menus.Exists("Update Material Row") Then

g_B1Connection.Application.Menus.RemoveEx("Update Material Row")

End If

If g_B1Connection.Application.Menus.Exists("Add Material Row") Then

g_B1Connection.Application.Menus.RemoveEx("Add Material Row")

End If

If g_B1Connection.Application.Menus.Exists("Delete Material Row") Then

g_B1Connection.Application.Menus.RemoveEx("Delete Material Row")

End If

If g_B1Connection.Application.Menus.Exists("Update Operation Row") Then

g_B1Connection.Application.Menus.RemoveEx("Update Operation Row")

End If

If g_B1Connection.Application.Menus.Exists("Add Operation Row") Then

g_B1Connection.Application.Menus.RemoveEx("Add Operation Row")

End If

If g_B1Connection.Application.Menus.Exists("Delete Operation Row") Then

g_B1Connection.Application.Menus.RemoveEx("Delete Operation Row")

End If

End Select

Else

Select Case eventInfo.ItemUID

Case "mtxOper"

g_B1Connection.Application.Menus.RemoveEx("Update Operation Row")

g_B1Connection.Application.Menus.RemoveEx("Add Operation Row")

g_B1Connection.Application.Menus.RemoveEx("Delete Operation Row")

Case "mtxMatl"

g_B1Connection.Application.Menus.RemoveEx("Update Material Row")

g_B1Connection.Application.Menus.RemoveEx("Add Material Row")

g_B1Connection.Application.Menus.RemoveEx("Delete Material Row")

End Select

End If

Catch ex As Exception

MessageBox.Show(ex.Message)

End Try

End Sub

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Further testing showed that if I cooment out the following line from behind the right-click function the menu stays in order.

Dim WOMaintOperForm As New LBSI_WOMaintOper(WO, Line, Code, Mode)

I am firing off a form from behind the right click. For some reason I never return back to the False part of the Right-Click event when I run this line of code.

Thanks,

EJD