Class based event handler procedures in procedures

Posted by asthomas on 10-Nov-2011 01:38

Hi there,

OpenEdge 10.2B05

Dynamics & Dynamics4.Net

I need to catch and handle an event from an OOABL class in a super procedure for a Dynamics viewer. Basically what I want to do is catch the drop event from a .Net control and have code in my viewer super procedure that fills out the fields on my viewer.

I thought I had set this up to work as it should (with some guidance from Mike), but I keep having problems with the basic functions in ADM2 & Dynamics not being available in the context of my event procedure.

It looks like TARGET-PROCEDURE is the class publishing the event and not the super procedure I am running in, and even though I can see the internal entries with the functions I need in THIS-PROCEDURE:INTERNAL-ENTRIES.

I have tried (per Mikes suggestion to create a procedure prototype for the event procedure - but without any luck. I may be doing something wrong or overlooking something simple....

Has anyone else worked with this challenge and got it working? If so, what is your 'recipie' ?

TIA

Thomas

All Replies

Posted by Wouter Dupré on 10-Nov-2011 01:40

Hi,

Thank you for your email. Currently I'm out of the office. I will return on November 14. During my absence I will have no/limited access access to email. For urgent matters, call me on my mobile and leave a message, call our office, or contact Gary Calcott (gcalcott@progress.com).

Best regards,

Wouter

--

Wouter Dupré

Senior Solutions Consultant

Progress Software NV

A. Stocletlaan 202 B | B-2570 Duffel | Belgium

Office +32 (0) 15 30 77 00 | Mobile +32 (0) 478 50 00 49

Posted by Peter Judge on 10-Nov-2011 07:14

asthomas wrote:

Hi there,

OpenEdge 10.2B05

Dynamics & Dynamics4.Net

I need to catch and handle an event from an OOABL class in a super procedure for a Dynamics viewer. Basically what I want to do is catch the drop event from a .Net control and have code in my viewer super procedure that fills out the fields on my viewer.

I thought I had set this up to work as it should (with some guidance from Mike), but I keep having problems with the basic functions in ADM2 & Dynamics not being available in the context of my event procedure.

It looks like TARGET-PROCEDURE is the class publishing the event and not the super procedure I am running in, and even though I can see the internal entries with the functions I need in THIS-PROCEDURE:INTERNAL-ENTRIES.

I have tried (per Mikes suggestion to create a procedure prototype for the event procedure - but without any luck. I may be doing something wrong or overlooking something simple....

Has anyone else worked with this challenge and got it working? If so, what is your 'recipie' ?

TIA

Thomas

So the event is being caught OK, it's just that something like setDataModified() canot be called? Event with dynamic-function?

-- peter

Posted by asthomas on 10-Nov-2011 07:17

yes - the event is firing fine. The call stack is just messed up.

I can see that THIS-PROCDURE = the super procedure and TARGET-PROCEDURE = the class the event is being fired from.

Posted by Peter Judge on 10-Nov-2011 07:20

I can see that THIS-PROCDURE = the super procedure and TARGET-

PROCEDURE = the class the event is being fired from.

That sounds like a bug to me.

-- peter

Posted by asthomas on 10-Nov-2011 07:25

Any suggestions for a work-around?

Regards / Med Venlig Hilsen 

Thomas Hansen

Director

Posted by Peter Judge on 10-Nov-2011 07:29

Untested, but in theory ...

Create a 'catcher class' that subscribes to the event (DropEventHandlerHelper, say). In that class' constructor, pass the procedure handle of your viewer. Then, when the handler catches the event, run something in the viewer that does what you want it to do.

def var oDEHH as DropEventHandlerHelper .

oDEHH = new DropEventHandlerHelper(target-procedure).

class DropEventHandlerHelper:

  constructor DropEventHandlerHelper(poTarget as handle).

   method public void OnDropEvent_Handler(<>).

     run HandleDropEvent in phTarget (<>).

   end method.

end class

I'd suggest defining the signature of HandleDropEvent in the viewer exactly the same as in the class, so that when you can subscribe from the .P, you can simply remove the helper class and things will continue to work without any other changes.

-- peter

Posted by Admin on 10-Nov-2011 07:32

asthomas schrieb:

Test it on OE11 beta and report it as a beta bug when it's still there.

Posted by asthomas on 11-Nov-2011 01:50

Peter - you're a star!

I now have it working very nicely with an "EventHandlerHelper".

Regards / Med Venlig Hilsen 

Thomas Hansen

Director

This thread is closed