IB Statements/eventwait
From CometWiki
EVENTWAIT statement
Syntax: EVENTWAIT
Discussion: The EVENTWAIT statement causes Comet to wait for an event to occur. An event is some action that is external to the program, such as a mouse click on a Comet hyperlink.
EVENTWAIT is placed in the program following an EVENTSUB statement. When the program executes the EVENTWAIT statement, Comet waits for the event to occur. In effect, the EVENTWAIT statement performs the same function as the WAIT statement, although without any screen interaction. Some important notes:
In the event handling subroutine, if the EVENTSUB has been set to an event handling subroutine before the RETURN statement is executed, program flow returns to the EVENTWAIT statement when the RETURN statement is executed (see Example 1).
If the EVENTSUB trap has been turned off (EVENTSUB with no parameters) or has not been re-established before the RETURN statement is executed. program flow goes to the statement following the EVENTWAIT statement (see Example 2).
History: This statement was added in Build 311.
Example1
Print (Hyperlink=... Print (Hyperlink=... Print (Hyperlink=... . EVENTSUB GetEvent,Event$,Source$ . EVENTWAIT . . . GetEvent: . . . EVENTSUB GetEvent,Event$,Source$ ! Re-establish event trap Return ! Return to EVENTWAIT
Example 2:
Print (Hyperlink=... Print (Hyperlink=... Print (Hyperlink=... . EVENTSUB GetEvent,Event$,Source$ . EVENTWAIT STOP . . GetEvent: . . . EVENTSUB ! clear Eventsub trap Return ! Return to STOP statement