Language Reference Guide : System Classes : ProcExec Class : WaitFor Method
 
Share this page          
WaitFor Method
The WaitFor method causes the executing frame to ignore all events from the user or other SendUserEvent methods until a specified event occurs.
This method has the following syntax:
event = CurExec.WaitFor(eventname = varchar(256))
This method has the following parameter:
eventname
Identifies the event for which the frame is waiting. When the frame receives this event from another frame, control returns to the statement immediately following the WaitFor call.
The method is frequently used immediately following a SendUserEvent method to another executing frame to wait for acknowledgment and processing of that event.
The WaitFor method returns an event object that contains the eventname, messageobject, messageinteger, messagefloat, and messagevarchar parameters sent with the SendUserEvent call that completes the method.
You can use the WaitFor method as follows:
Within a frame (but outside any local procedure), use the WaitFor method only on the CurExec or CurFrame system variables.
Within a local procedure inside a frame, use the WaitFor method on either CurExec, CurFrame, or CurProcedure.
Within any type of procedure, use the WaitFor method on either CurExec or CurProcedure.
Within a method of a user class, use the WaitFor method on either CurExec or CurMethod.
This method causes the current frame, procedure, or method to suspend execution until the specified event is sent to the frame that called it (either directly or indirectly through a series of procedure calls or method invocations).
Do not use the WaitFor method when you are sending the user event from the current frame to itself. The user event is never sent to the frame, and the event block never continues.
For more information about communicating between frames and procedures, see the Programming Guide.