Aspect question: How do I assign an EventHandler

The code I want to add is:

[Pascal] MyObject.Event += @MyMethod
or
[Mercury] Addhandler MyObject.Event, AddressOf(MyMethod)

How do I do this in an aspect?
Just write it the same as [Pascal] MyObject.Event = MyObject.Event + @MyMethod?

@ck, we really need to look at properly documenting Cirrus’ APIs…

This does not answer my question …

Sorry. Completely missed your question.

I’ll look up the exact syntax Monday but it’s going to be a call to my object, ‘add_event’, with an address of expression to My method.

1 Like
// This represents @self.MyMethod
var lMeth :=  new UnaryValue(new IdentifierValue(new SelfValue(), 'MyMethod'), UnaryOperator.AddressOf);

//
var lCall : =new ProcValue(new SelfExpression(), ev.AddMethod, lMeth);

This presumes ev is the IEvent for the event, and it’s located on the current class (SelfExpression).

1 Like