.NET Event Handler Question

Posted by ruan007 on 01-Jul-2010 23:30

Hi,

I have a .net class publishes an event whose eventhandler signature has 3 parameters. My ALB class doesn't seem to respond to the event.

The .net eventhandler signature is something like eventhandler(first as <.net class>, second as <.net class>, third as <.net class>). Is it true that ABL only handles .NET event that conforms to .NET Framework convention, which is eventhandler(sender as Object , e as EventArgs).

If it doesn't, does anyone knows a workaround?

Thanks

All Replies

Posted by Thomas Mercer-Hursh on 03-Jul-2010 13:35

You might get more attention on the ABL GUI for .NET forum.

Do you know whether or not the event is on the UI thread?  If it isn't, you are out of luck.

Posted by ruan007 on 03-Jul-2010 22:08

It's true that ABL doesn't support non-convention .NET events. I had to modify the .net event to conform the standard format, now my ABL class can respond to the event.

I hope Progress will support that in future ABL release .

Posted by Admin on 04-Jul-2010 02:06

ruan007 schrieb:

I hope Progress will support that in future ABL release .

If it's important for you, you should log it as an enhancement request. This behaviour is documented and so I don't expect any change without good reasons:

As a .NET Framework convention, .NET event handler signatures have a void return type and

consist of two input parameters, both of which are object references. The first parameter,

identified as the sender, is always a reference to a System.Object instance, which represents

the object that defines and publishes the event. The second parameter is typically a reference to

an event arguments class instance that is generated by .NET each time it publishes the event. An

event arguments class can be a System.EventArgs (the base class for all event arguments

classes) or any derived class.


Note: .NET actually supports any signature for an event that is defined by its delegate.

However, ABL only supports .NET event signatures defined by delegates that conform

to this .NET Framework convention.

I have the feeling that this has to do with the implementation of the Bridge. Events and overloaded methods are the only ways the CLR can communicate with the AVM. My guess is that Progress has a general purpose event handler method on the .NET side of the bridge that has a signature of System.Object sender, System.EventArgs e. 

This thread is closed