I have a .p, with the following wait-for :
wait-for close of this-procedure.
None of the widgets used in the WAIT-FOR statement are in a state (such as SENSITIVE) such that the specified event can occur. WAIT-FOR terminated. (4123)
It's not waiting because the handle is valid, it's waiting for that event on that handle to stop allowing user input on the UI widgets, but there's no active widgets - hence the error.
I have no widgets active by design - this is running in character
batch mode ...
So, if you have no active widgets, how do you expect to ever get Window-Close?
err, I wasn't . I was waiting for close of this-procedure. Not a window.
this-procedure is a valid handle to a running .p
"THIS-PROCEDURE: A handle to the procedure object for the currently
executing procedure. This object allows you to read and modify the
context of the current procedure. "
"The THIS-PROCEDURE handle supports all the attributes of the
procedure object handle. "
"Procedure object handle "
A handle that can reference the context of one of the following
procedure object instances:
•A persistent procedure in the current session
•A persistent procedure in a remote session (on an AppServer)
•A running procedure in the current session, including the currently
executing procedure or any other procedure currently on the session
call stack
•A procedure object that encapsulates a Web service operation (Web
service procedure object)
This object allows you to read and modify the context of the specified
procedure according to the type of procedure object instance.
Grrrr....
If I am not mistaking, batch clients do not support event driven programming.
mikefe wrote:
If I am not mistaking, batch clients do not support event driven programming.
Unless the events are things associated with stuff like sockets, etc.
IIRC, not being able to do "Wait-for" event-driven programming in batch mode has been an issue for some time, which means that one has to use, sub-optimal means like "PAUSE 1" and PROCESS-EVENTS. (I haven't done this in a long time, so my memory on this is a bit fuzzy.)
Urgh, sorry. When I said "batch mode" I actually meant appserver / webspeed mode .
Strangely enough, the problem is now gone ...
i thought in webspeed/appsrv environment no wait-for is allowed... not even for sockets since there is already one server-socket waiting for connections, did that changed somehow???
this snippet of code is taken directly from src/web/objects/web-disp.p
there are a couple of wait-for in there
/* Wait for a web-request to come in */
WAIT-FOR-BLOCK:
REPEAT ON ERROR UNDO WAIT-FOR-BLOCK, LEAVE WAIT-FOR-BLOCK
ON QUIT UNDO WAIT-FOR-BLOCK, LEAVE WAIT-FOR-BLOCK
ON STOP UNDO WAIT-FOR-BLOCK, NEXT WAIT-FOR-BLOCK:
IF lStateAware THEN DO:
/* Usually return to the "None" state, except in a RETRY which is
treated like a start. */
transaction-state = IF transaction-state EQ "RETRY-PENDING":U THEN
"START-PENDING":U ELSE "NONE":U .
RUN check-exclusive-pause IN web-utilities-hdl (OUTPUT dPausePeriod).
IF transaction-state EQ "NONE" THEN DO:
IF dPausePeriod > 0 AND NOT cfg-eval-mode THEN
WAIT-FOR "WEB-NOTIFY":U OF DEFAULT-WINDOW
PAUSE dPausePeriod EXCLUSIVE-WEB-USER.
ELSE DO:
/* Increment the EXCLUSIVE-ID manually every time we are in a
non-locking state. */
{&MANUAL-WSEU-INCREMENT}
WAIT-FOR "WEB-NOTIFY":U OF DEFAULT-WINDOW.
END.
END. /* IF transaction-state EQ "NONE"... */
[snip]ELSE DO:
IF iBatchInterval > 14 THEN DO:
WAIT-FOR "WEB-NOTIFY":U OF DEFAULT-WINDOW PAUSE iBatchInterval.
/* If there is a batch program that needs to be run, then run it now. */
RUN init-batch IN web-utilities-hdl NO-ERROR.
RUN run-batch-object IN web-utilities-hdl NO-ERROR.
RUN end-batch IN web-utilities-hdl NO-ERROR.
END.
ELSE
WAIT-FOR "WEB-NOTIFY":U OF DEFAULT-WINDOW.
END.
this snippet of code is taken directly from src/web/objects/web-disp.p
And you shouldn't add another level... One world - one wait-for.