ECLScreenReco Class

The ECLScreenReco class is the engine for the Host Access Class Library screen recognition system. It contains the methods for adding and removing descriptions of screens. It also contains the logic for recognizing those screens and for asynchronously calling back to your handler code for those screens.

Think of an object of the ECLScreenReco class as a unique recognition set. The object can have multiple ECLPS objects that it watches for screens, multiple screens to look for, and multiple callback points to call when it sees a screen in any of the ECLPS objects.

All you need to do is set up your ECLScreenReco objects at the start of your application, and when any screen appears in any ECLPS that you want to monitor, your code will get called by ECLScreenReco. You do absolutely no legwork in monitoring screens!

Here's an example of a common implementation:

class MyApp { 
ECLPS myECLPS('A'); // My main HACL PS object
ECLScreenReco myScreenReco(); // My screen reco object 
ECLScreenDesc myScreenDesc(); // My screen descriptor 
MyRecoCallback myCallback(); // My GUI handler 
 
MyApp() { 
// Save the number of fields for below 
ECLFieldList *fl = myECLPS.GetFieldList() 
Fl->Refresh(); 
int numFields = fl->GetFieldCount(); 
 
// Set up my HACL screen description object. Say the screen 
// is identified by a cursor position, a key word, and the 
// number of fields 
myScreenDesc.AddCursorPos(23,1); 
myScreenDesc.AddString("LOGON"); 
myScreenDesc.AddNumFields(numFields); 
 
 
// Set up HACL screen reco object, it will begin monitoring here 
myScreenReco.AddPS(myECLPS); 
myScreenReco.RegisterScreen(&myScreenDesc, &myCallback); 
} 
 
 MyApp() { 
myScreenReco.UnregisterScreen(&myScreenDesc, &myCallback);
myScreenReco.RemovePS(&eclPS);
}
 
public void showMainGUI() { 
// Show the main application GUI, this is just a simple example 
} 
 
 
// ECLRecoNotify-derived inner class (the "callback" code) 
class MyRecoCallback public: ECLRecoNotify { 
public: void NotifyEvent(ECLScreenDesc *sd, ECLPS *ps) { 
// GUI code here for the specific screen 
// Maybe fire a dialog that front ends the screen 
} 
 
public void NotifyError(ECLScreenDesc *sd, ECLPS *ps, ECLErr e) { 
// Error handling 
} 
 
 
public void NotifyStop(ECLScreenDesc *sd, ECLPS *ps, int Reason) { 
// Possible stop monitoring, not essential 
} 
} 
 
}
 
int main() { 
MyApp app = new MyApp(); 
app.showMainGUI(); 
}