4. 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 = CurFrame.WaitFor(eventname = varchar(265))
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 CurFrame system variable.
Within a local procedure inside a frame, use the WaitFor method on either CurFrame or CurProcedure (the effect is the same either way).
The current procedure suspends execution until the specified event is sent to the current frame.
Within any type of procedure, use the WaitFor method on the CurProcedure system variable.
This method causes the current procedure to suspend execution until the specified event is sent to the frame that called the current procedure (either directly or indirectly through a series of callproc statements).
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.