This example defines the event as the display of the string "MAIN" in any screen position. When the event occurs the number 1 followed by Enter is transmitted to the host. After the first occurrence, the event is disabled.

Sub EventDemo ()

With Session

 .RemoveOnEvent rcAllEvents

 .OnEvent 1, rcDisplayString, _

    ".TransmitANSI ""1"" .TransmitTerminalKey rcIBMEnterKey", _

    rcEnable, rcEventDisable, "MAIN", rcAnyRow, rcAnyCol

End With

End Sub