ProvideX V8.20 > Language Reference > 2. Directives
111
ENABLE EVENT Directive
       Internal Event Enable
Formats
1. Timer Event: ENABLE EVENT ON TIM
2. Data Available on Channel Event: ENABLE EVENT ON DATA (chan)
3. On Close of Channel Event: ENABLE EVENT ON CLOSE (chan)
4. On Open Event: ENABLE EVENT ON OPEN
5. On Class Load Event: ENABLE EVENT ON LOAD CLASS
Where:
chan
Channel or logical file number.
Description
Use the ENABLE EVENT directive to enable the handling of various system events
within a ProvideX session. The generation and trapping of events requires that the
internal "*system.pvc" COM object be defined first.
See Also
DISABLE EVENT Directive, p.93
WAIT FOR EVENT Directive, p.371
Example
00010
DEF OBJECT PvxComID,"*system" ! Activate support for System Events
00020
ENABLE EVENT ON TIM=2 ! Activate timer event at two second
intervals
00030
ON EVENT "TimeOut" FROM PvxComID PREINPUT 99 ! Establish how to
handle the event
00031
c=0
00040
WHILE 1
00050
INPUT *
00060
IF CTL=99 \
THEN c++;
PRINT "Timeout ",c;
IF c>3 \
THEN BREAK
00070
WEND
00075
DISABLE EVENT ON TIM ! Deactivate timer event
00077
DROP OBJECT PvxComID
00080
END