Skip to Content
0
Former Member
Mar 02, 2009 at 06:27 PM

Events Filters method

495 Views

Hi,

in the SDK documentation, i see 2 differents ways to applied events filter, could you please explain me what's the difference between both and if both works fine.

In first method below the Forms are assigned after all events filer (that's correct?)

1st method :

Private Sub SetFilters()
    '// Create a new EventFilters object
    oFilters = New SAPbouiCOM.EventFil

    '// add an event type to the container
    '// this method returns an EventFilter object

    oFilter = oFilters.Add(SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED)
    oFilter = oFilters.Add(SAPbouiCOM.BoEventTypes.et_COMBO_SELECT)
    oFilter = oFilters.Add(SAPbouiCOM.BoEventTypes.et_VALIDATE)
    oFilter = oFilters.Add(SAPbouiCOM.BoEventTypes.et_LOST_FOCUS)
    oFilter = oFilters.Add(SAPbouiCOM.BoEventTypes.et_KEY_DOWN)
    oFilter = oFilters.Add(SAPbouiCOM.BoEventTypes.et_MENU_CLICK)
    oFilter = oFilters.Add(SAPbouiCOM.BoEventTypes.et_CLICK)

    '// assign the form type on which the event would be processed
    oFilter.AddEx("149") 'Quotation Form
    oFilter.AddEx("139") 'Orders Form
    oFilter.AddEx("133") 'Invoice Form
    oFilter.AddEx("169") 'Main Menu

    SBO_Application.SetFilter(oFilters)

End Sub

2nd method (most commonly used i think) :

oFilters As SAPbouiCOM.EventFilters
oFilter As SAPbouiCOM.EventFilter

Private Sub SetFilters()

    '// Create a new EventFilters object
    Set oFilters = New SAPbouiCOM.EventFilters

    '// Add an event type to the container
    '// This method returns an EventFilter object
    Set oFilter = oFilters.Add(et_CLICK)
        '// The form types to which the event will apply
        oFilter.Add 139 'Orders Form
        oFilter.Add 142 'Purchase Form

    Set oFilter = oFilters.Add(et_KEY_DOWN)
        '// Again the form type to which the event will apply
        oFilter.Add 139 'Orders Form
    SBO_Application.SetFilter oFilters

End Sub