The following example displays a message as soon as any of three defined strings appears on the screen. It uses an array to hold the strings. Try this procedure in combination with the demonstration 3270 host.
Public items(1 to 3) as String
Sub DefineDisplayStringEvents ()
items(1) = "library"
items(2) = "Calendar"
items(3) = "Mountain"
With Session
.DefineEvent 1, rcDisplayString, "", items(1), rcAnyRow, rcAnyCol, 1
.DefineEvent 2, rcDisplayString, "", items(2), rcAnyRow, rcAnyCol, 1
.DefineEvent 3, rcDisplayString, "", items(3), rcAnyRow, rcAnyCol, 1
End With
End Sub
DefinedEvent responds when the event is triggered. Event procedures such as this must be created in the code module for the Reflection Session object (ThisSession).
Private Sub Session_DefinedEvent(ByVal EventNumber As Long, ByVal EventType As Long, ByVal TheString As String, ByVal Row As Long, ByVal Column As Long, ByVal Key As Long)
MsgBox "String that appeared: " & items(EventNumber)
ClearEvents
End Sub