ECLScreenReco 类

ECLScreenReco类 是主机访问类库屏幕识别系统的引擎。它包含添加和删除屏幕描述的方法。它还包含用于识别这些屏幕以及异步回调这些屏幕的处理程序代码的逻辑。

将 ECLScreenReco 类的对象视为唯一识别集。对象可以有多个 ECLPS 对象,它可以监视屏幕,多个要查找的屏幕,以及当它在任何 ECLPS 对象中看到屏幕时要调用的多个回调点。

您只需在应用程序启动时设置 ECLScreenReco 对象,当任何要监控的 ECLPS 中出现任何屏幕时,ECLScreenReco 就将调用代码。您完全无需监控屏幕!

以下是一个常用实现示例:

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(); 
}