cancel
Showing results for 
Search instead for 
Did you mean: 

Event Filtering

Former Member
0 Kudos

Hi

Can anyone give me any help ref event filtering please. I think I have added the relevant filters ok. I have added a menu item to the main sbo menu which in turn has 3 subitems. When a subitem is clicked a form is loaded.

When I click on the first menu item the 3 sub items are displayed, but when I click on those no form is loaded.

I understand event filtering speeds things up

Any ideas greatly received

Regards Andy

ps sbo V6.5

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

If you have the (current version of) the help fiel for the UI-com object: open it, open 'contents', open 'Programming with the UI API', open 'Event handling' and try the article 'Filtering events'.

Otherwise, here is a code fragment I'm using

'// Create a new EventFilters object

Set oSboFilters = New SAPbouiCOM.EventFilters

'

' Set oSboFilter = oSboFilters.Add(et_FORM_KEY_DOWN)

' oSboFilter.Add EB_EXCELQUOTATION

Set oSboFilter = oSboFilters.Add(et_ITEM_PRESSED)

oSboFilter.Add OFFERTE_FORM

oSboFilter.Add EB_EXCELQUOTATION

oSboFilter.Add EB_EXCELORDER

oSboFilter.Add EB_MAINTFORM

oSboFilter.Add EB_KAARTFORM

oSboFilter.Add ORDER_FORM

oSboFilter.Add LEVERING_FORM

oSboFilter.Add GOEDONTVANGST_FORM

Set oSboFilter = oSboFilters.Add(et_FORM_LOAD)

oSboFilter.Add OFFERTE_FORM

oSboFilter.Add ORDER_FORM

oSboFilter.Add LEVERING_FORM

Set oSboFilter = oSboFilters.Add(et_MENU_CLICK)

'// Setting the application with the EventFilters object

'// in this case we will process a click event for form types 142 and 139

'// and we will process a key down event for for form type 139

Sbo_application.SetFilter oSboFilters

But that is just some general eventfiltering info. Any way an event you are not filtering, you will not receive. BUT if you disable the event filters you will receive every event (both in befroe and after event) So you could use that to check what event you are not catching (but do not let sbo loose focus cuase that generattes events too and then it's all a pain in the ...)

Regards,

Jacques

Former Member
0 Kudos

Hi Jacques

Thanks for your help, I think I have done what you said but I may of missed off the et_MENU_CLICK event.

I will check my code and let you know

Regards Andy

Former Member
0 Kudos

Hi Jacques

I added the following to my code -

Set oFilter = oFilters.Add(et_MENU_CLICK)

oFilter.Add 169

But it still doesn't seem to work.

Regards Andy

Former Member
0 Kudos

Hi Andy,

Why are you restricting your menu-click event to form 169? Try removing that restriction and you should catch all menu_click events. Next you can check in your general menu_click handler which ones you want. In my case that is like this:

Private Sub SBO_Application_MenuEvent(pval As SAPbouiCOM.IMenuEvent, BubbleEvent As Boolean)

Dim oB1EbOrderForm As EBL_Order

Dim oB1EBMaintForm As EBL_Maint

Dim lngFormCount As Long

Dim strFormName As String

On Error GoTo err_menuevent

If blnResponseAllowed Then

If pval.BeforeAction = True Then

Select Case pval.MenuUID

Case "EB_MENU0"

'Process orderinkoop

Set oB1EbOrderForm = New EBL_Order

'...etc

Case "EB_MENU1"

'parameter onderhoud

Set oB1EBMaintForm = New EBL_Maint

'etc...

Case DUPLICEREN

For lngFormCount = 0 To Sbo_application.Forms.Count

'determine active form

If Sbo_application.Forms(lngFormCount).Selected Then

If Sbo_application.Forms(lngFormCount).Type = OFFERTE_FORM Then

Call HandleEvents_SBO_QUOTATIONDuplicate(Sbo_application.Forms(lngFormCount).UniqueID)

End If

Exit For 'bye-bye, stop wasting cpu cycles...

End If

Next

Case PRINTKNOP

For lngFormCount = 0 To Sbo_application.Forms.Count

'determine active form

If Sbo_application.Forms(lngFormCount).Selected Then

Select Case Sbo_application.Forms(lngFormCount).Type

Case ORDER_FORM 'order

Call HandleEvents_SBO_ORDERPrint(Sbo_application.Forms(lngFormCount).UniqueID)

Case OFFERTE_FORM 'offerte

Call HandleEvents_SBO_QUOTATIONPrint(Sbo_application.Forms(lngFormCount).UniqueID)

Case PURCH_FORM

Call HandleEvents_SBO_PURCHASEPrint(Sbo_application.Forms(lngFormCount).UniqueID)

End Select

Exit For 'bye-bye, stop wasting cpu cycles...

End If

Next

End Select

End If

End If

BubbleEvent = True

err_menuevent:

'no action, just taking care the addon will not crash

Hope this helps,

Jacques

Former Member
0 Kudos

Hi Jacques

Sorry, my mistake, I thought you had to link a form to an event you wanted.

I will try that and let you know

Thanks again

Regards Andy

Former Member
0 Kudos

Hi Jacques

All seems to work fine, thanks for all your help

Regards Andy