# ENABLE EVENT Internal Event Enable

> Source: https://manual.pvxplus.com/directives/enable-event

## Formats

|  |  |  |
| --- | --- | --- |
| 1\. | *Timer Event*: | **ENABLE EVENT ON TIME** |
| 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

***(Windows Only)***

Use the **ENABLE EVENT** directive to enable the handling of various system events within a PxPlus session. The generation and trapping of events requires that the internal "\*system.pvc" COM object be defined first.

## See Also

[DISABLE EVENT Internal Event Disable](https://manual.pvxplus.com/directives/disable-event)  
**[WAIT FOR EVENT Temporarily Halt Execution](https://manual.pvxplus.com/directives/wait-for-event)**

## Example

```
def object PvxComID,"*system" ! Activate support for System Events
enable event on tim=2 ! Activate timer event at two second intervals
on event "TimeOut" from PvxComIDpreinput 99 ! Establish how to handle the event
c=0
while 1
     input *
     if ctl=99 \
          then c++;
                  print "Timeout ",c;
                  if c>3 \
                       then break
wend
disable event on tim ! Deactivate timer event
drop object PvxComID
end
```
