Subscribe and .net

Posted by jmls on 22-May-2009 11:44

I have several windows and dialogs that I wish to convert to .net. However, some of these use the "subscribe to foo anywhere" construct. How can I get a .net form/dialog to subsribe to a PUBLISH ?

All Replies

Posted by Admin on 22-May-2009 11:54

Use a procedure as an "event helper".

Class TestClass.cls would use an persistent procedure TestClass-Subscriber.p .

In the constructor,

RUN TestClass-Subscirber.p PERSISTENT SET hEventProcedure (THIS-OBJECT). 

In the destructor,

DELETE PROCEDURE hEventProcedure.

The TestClass-Subscriber.p is needs an

DEFINE INPUT PARAMETER poFormInstance AS TestClass NO-UNDO.

The persistent procedure may subscribe to the events using internal procedures as event handler and will call a method in the class as the event handler.

oFormInstance:EventHandlerMethod().

Depending on the level of generalization possible, Interfaces or common base classes should be used....

Ugly, but prooven.

Posted by jmls on 22-May-2009 12:11

Aw, crap. I had to do something similar for activex and classes. I had hoped there was a cleaner way.

This is just so , so, so, pooey.

Thanks anyway.

Posted by jmls on 22-May-2009 15:41

Yeah, that worked. Grumble, Grumble.

This thread is closed