cancel
Showing results for 
Search instead for 
Did you mean: 

General question about event handler in several classes

Former Member
0 Kudos
69

Hi all,

I want to modularize my addon and thus split up my event handling methods which are grown to an enormous size in my main class.

Is there a problem if I have e.g. 2 classes, each one adding the same event handler?

Sample:

class 1:

oSBOapp.RightClickEvent += new SAPbouiCOM._IApplicationEvents_RightClickEventEventHandler(oSBOapp_RightClickEvent);

private void oSBOapp_RightClickEvent(ref SAPbouiCOM.ContextMenuInfo eventInfo, out bool BubbleEvent)

{}

class 2:

oSBOapp.RightClickEvent += new SAPbouiCOM._IApplicationEvents_RightClickEventEventHandler(oSBOapp_RightClickEvent);

private void oSBOapp_RightClickEvent(ref SAPbouiCOM.ContextMenuInfo eventInfo, out bool BubbleEvent)

{}

I have already tested it and I could not recognize any issue (performance, error, etc.). But maybe there is a better way to split up the whole bunch a litte bit more.

Thanks in advance!

Regards

Sebastian

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Okay, maybe this is not the best way.. when the event handling is in action on the same form, they don't work properly (of course....)