Reflection Desktop VBA Guide
Attachmate.Reflection.Objects.Emulation.IbmHosts Library / Attachmate.Reflection.Objects.Emulation.IbmHosts Library / IbmScreen Object / DefinedEvent Event
Example
In This Topic
DefinedEvent Event (IbmScreen)
In This Topic
This event is triggered when an event defined by the DefineEvent method occurs. Events defined in this way remain defined as long as your Reflection session lasts, or until they are removed using the RemoveEvent or ClearEvents methods.
Syntax
private Sub IbmScreen_DefinedEvent ( 
   ByVal EventNumber As Integer, _
   ByVal EventType As DefinedEventType, _
   ByVal TheString As String, _
   ByVal Row As Integer, _
   ByVal Column As Integer _
) 

Parameters

EventNumber
The event identifier. This corresponds to the DefineEvent return value.
EventType
The type of event.This is a DefinedEventType Enumeration value that indicates the type of event fired.
TheString
When pertinent, the string value associated with the event.
Row
When pertinent, the screen row associated with the event.
Column
When pertinent, the screen column associated with the event.
Example
This example defines an event that occurs when there is no host activity for 30 seconds and handles the event to disconnect the session.
'Place this code in the ThisIbmTerminal code window
Private Sub IbmTerminal_AfterConnect(ByVal sender As Variant)
    
    ThisIbmScreen.ClearEvents
 
    'Define an event that occurs when there is no host activity for 30 seconds
    ThisIbmScreen.DefineEvent 1, DefinedEventType_Silence, "00:00:30", " ", 0, 0
    
End Sub
 
'Place this code in the ThisIbmScreen code window. The following procedure is executed when a defined event triggers.
Private Sub IbmScreen_DefinedEvent(ByVal EventNumber As Long, ByVal EventType As Attachmate_Reflection_Objects_Emulation_IbmHosts.DefinedEventType, ByVal TheString As String, _
     ByVal row As Long, ByVal column As Long)
    
    'If the host is inactive for the specified interval, disconnect
    If EventNumber = 1 Then
    
        ThisIbmTerminal.Disconnect
        
    End If
    
End Sub
See Also