Event Processing Example
The following is a short example of how to implement Screen Recognition Events:
Dim myPS as Object
Dim myScreenDesc as Object
Dim WithEvents reco as autECLScreenReco 'autECLScreenReco added as reference
Sub Main()
' Create the objects
Set reco= new autECLScreenReco
myScreenDesc = CreateObject("PCOMM.autECLScreenDesc")
Set myPS = CreateObject("<dvcfobj props="textent conref-pcomm_short">&pcomm_short;.autECLPS")
myPS.SetConnectionByName "A"
' Set up the screen description
myScreenDesc.AddCursorPos 23, 1
myScreenDesc.AddString "LOGON"
myScreenDesc.AddNumFields 59
' Add the PS to the reco object (can add multiple PS's)
reco.addPS myPS
' Register the screen (can add multiple screen descriptions)
reco.RegisterScreen myScreenDesc
' Display your form or whatever here (this should be a blocking call, otherwise sub just ends
call DisplayGUI()
' Clean up
reco.UnregisterScreen myScreenDesc
reco.RemovePS myPS
set myPS = Nothing
set myScreenDesc = Nothing
set reco = Nothing
End Sub
'This sub will get called when the screen Description registered above appears in
'Session A. If multiple PS objects or screen descriptions were added, you can
'determine which screen and which PS via the parameters.
Sub reco_NotifyRecoEvent(autECLScreenDesc SD, autECLPS PS)
If (reco.IsMatch(PS,myScreenDesc)) Then
' do your processing for your screen here
End If
End Sub
Sub reco_NotifyRecoError
'do your error handling here
End sub
Sub reco_NotifyRecoStop(Reason as Long)
'Do any stop processing here
End sub