How-to Exit Window or Procedure Inside a Subscribe Handler?

Posted by jquerijero on 06-Oct-2008 10:03

I need to close a window after receiving an event that I subscribed to using the SUBSCRIBE keyword. When I APPLY "WINDOW-CLOSE" TO , the window closes but it seems to be stuck. Good thing the window has PStimer where I can just inspect a variable then APPLY "WINDOW-CLOSE" TO which is working as expected.

Now, I need to do almost the same thing but this time it needs to be a procedure. I noticed that if I run APPLY "CLOSE" TO THIS-PROCEDURE, the procedure doesn't seem to return.

CODE SNIPPET of the procedure

SUBSCRIBE "OnResponseReceived" ANYWHERE RUN-PROCEDURE "ResponseReceived".

MAIN-BLOCK:

. . .

. . .

WAIT-FOR CLOSE OF THIS-PROCEDURE

PROCEDURE ResposeReceived:

. . .

. . .

APPLY "CLOSE" TO THIS-PROCEDURE.

END PROCEDURE.

Message was edited by:

Joseph Querijero

All Replies

Posted by kevin_saunders on 07-Oct-2008 02:49

A better method would be to have the original PUBLISHer subscribe to an event which then either deletes itself (if persistent), or applies close to itself. The 'ResponseReceived' procedure would be the publisher of said event.

This thread is closed