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