[ |../../index.htm#lansa/lansa050_2330.htm]
現在地: RAMP-TSガイド > スクリプト > 使用方法 > SENDKEY ファンクション
SENDKEY ファンクション
キーを押す操作をエミュレートします。
構文
SENDKEY(sKeyName, oPayload)
パラメータ
SKeyName |
必要。キーの名前を含む文字列。 詳細は「SENDKEY ファンクションのファンクション・キー名」を参照してください。 |
|---|---|
oPayload |
任意。 ファンクションで渡されるオブジェクト。 |
|
戻り値
なし
備考
通常、このファンクションは非同期の 5250 サーバー側操作を開始します。RAMP-TS スクリプトは、このファンクションを呼び出した直後にすべての処理を終了し、非同期の操作が完了するまで何も実行するべきではありません。
非同期操作の完了は、結果の 5250 画面表示の到着スクリプトの実行により示されます (待ち行列に入れられるスクリプト・ファンクションは、このスクリプト・ファンクションの実行の前に待ち行列に入れられる必要があります)。
例
SENDKEY(KeyEnter);
以下のサンプルは、SENDKEYおよびQ_SENDKEYファンクションでペイロード・パラメータを使用する方法を示しています。
オブジェクトが作成され、EnterキーBUTTONCLICKイベントで値がロードされます。次に、オブジェクトはSENDKEY ファンクションのoPayloadパラメータとして渡されます。
/* ====================================================== / / ================== BUTTONCLICK ===================== / / ====================================================== / / sButton: The button that was clicked */
vHandle_BUTTONCLICK: function(sButton) {
var bReturn = true;
if (HANDLE_PROMPT()) return(bReturn); /* If the focus element is automatically prompted finish now */
/* <BUTTONCLICK /> - Do not remove or alter this line */
/* Handle function keys and buttons */
switch (sButton) { case KeyEnter: var objEmp = new Object(); objEmp.strEmpno = GETVALUE("empno"); objEmp.strGName = GETVALUE("givename"); objEmp.strSName = GETVALUE("surname"); SENDKEY(KeyEnter, objEmp); break; case KeyF3: SENDKEY(KeyF3); break; case KeyF4: SENDKEY(KeyF4); break; case KeyF12: SENDKEY(KeyF12); break; case KeyF14: SENDKEY(KeyF14); break; case KeyF21: SENDKEY(KeyF21); break; case KeyF22: SENDKEY(KeyF22); break; default: SENDKEY(sButton); break; }
return(bReturn); },
次に、結果の画面のvHandle_Arriveファンクションはペイロードが渡された場合にペイロードから値を取得します。
/* ====================================================== / / ================== vHandle_ARRIVE ================== / / ====================================================== / / Handle arrival at this Destination / / oPayload: The payload supplied by the event initiator / / oPreviousForm: Reference to previous object Form*/
vHandle_ARRIVE: function(oPayload, oPreviousForm) { var bReturn = true;
SHOW_CURRENT_FORM(true); /* Show the form in the framework and show VLF buttons / HIDE_5250_BUTTONS(); / Hide any 5250 style buttons displayed / GET_FORM_MESSAGE(22); / Extract messages and hide the message line / SETBUSY(false); / Last thing done - turn off the busy state */
/* if there is something in the payload */ if (oPayload != null) { ALERT_MESSAGE("Employee Details from the payload are: Employee Number: ", oPayload.strEmpno,"Name: ", oPayload.strGName, oPayload.strSName); }
/* <ARRIVE /> - Do not remove or alter this line */
return(bReturn); },
[ |../../index.htm#lansa/lansa050_2330.htm]