The OFF EVENT statement undefines and disables a widget event that was defined and enabled earlier by an ON EVENT statement.
In the following example, the first line causes the program to go to the subroutine Event_handler when the SLIDER widget event CHANGED occurs. Then, the next line cancels the event branch. Thus, after the second line, the occurrence of the event CHANGED will not cause a branch to Event_handler.
ON EVENT @Slider;"CHANGED" GOSUB Event_handler .
.
OFF EVENT @Slider, "CHANGED"
There are three important differences between the OFF EVENT and DISABLE EVENT statements:
·
DISABLE EVENT temporarily disables the event, whereas OFF EVENT permanently deactivates the event.
·
Only one occurrence of the event will be logged if the event is disabled with a DISABLE EVENT statement. Therefore, the branch will be taken once the event is reenabled with an ENABLE EVENT statement.
·
The event will NOT be logged and the branch will never be taken if the event is deactivated with an OFF EVENT statement.