Skip to Content
0
Former Member
Jul 15, 2005 at 12:30 PM

Problem with menu events

22 Views

i'm creating a menu ,then , i create events like this :

Menu :

If oApplication.Menus.Exists("VidStore01") Then

Exit Sub

End If

Dim myPackage As SAPbouiCOM.MenuCreationParams

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

With myPackage

.Type = SAPbouiCOM.BoMenuType.mt_POPUP

.String = "Video Store"

.Enabled = True

.UniqueID = "VidStore01"

.Position = 100

.Checked = False

End With

Dim myMenuItem As SAPbouiCOM.MenuItem

Dim myMenus As SAPbouiCOM.Menus

myMenuItem = oApplication.Menus.Item("43520")

myMenus = myMenuItem.SubMenus

myMenuItem = myMenus.AddEx(myPackage)

Try

With myMenuItem

.SubMenus.Add("Sub01", "Movies On shelf", SAPbouiCOM.BoMenuType.mt_STRING, 1)

.SubMenus.Add("Sub02", "Movies Location", SAPbouiCOM.BoMenuType.mt_STRING, 2)

.SubMenus.Add("Sub03", "Add Movie", SAPbouiCOM.BoMenuType.mt_STRING, 3)

.SubMenus.Add("Sub04", "Rent / Return Movie", SAPbouiCOM.BoMenuType.mt_STRING, 4)

End With

Catch ex As Exception

oApplication.MessageBox(ex.Message)

End Try

events :

Private Function set_filter() As SAPbouiCOM.EventFilters

Dim oFilter As SAPbouiCOM.EventFilter

set_filter = New SAPbouiCOM.EventFilters

oFilter = set_filter.Add(SAPbouiCOM.BoEventTypes.et_FORM_LOAD)

With oFilter

.AddEx("169")

End With

oFilter = set_filter.Add(SAPbouiCOM.BoEventTypes.et_FORM_CLOSE)

With oFilter

.AddEx("169")

End With

oFilter = set_filter.Add(SAPbouiCOM.BoEventTypes.et_MENU_CLICK)

With oFilter

.AddEx("169")

End With

oFilter = set_filter.Add(SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED)

With oFilter

.AddEx("169")

End With

oFilter = set_filter.Add(SAPbouiCOM.BoEventTypes.et_COMBO_SELECT)

oFilter.AddEx("169")

End Function

oApplication.SetFilter(set_filter())

It works only when i open the "EventSpy" , if i close it, no more events are catched .

someone have en idea ?