ケース A:選択肢が見つかったときに、該当する行にカーソルを設定して Enter を押す。
uSubfileSearch: function(sToForm, sFindValue, sFindField, sMoreRecsField)
{
/* Subfile indexed fields are one based */
var iInd = 1;
var bFound = false;
while( (CHECK_FIELD_EXISTS(sFindField,iInd)) && !(bFound) )
{
/* Found, set the flag to true to cause the loop to end */
if (sFindValue == GETVALUE(sFindField,iInd))
{
bFound = true;
}
else /* Increase field index */
{
iInd++;
}
}
/* If found, position the cursor to the field and index and send an Enter key to cause that entry to be selected */
if (bFound)
{
SETCURSORTOFIELD(sFindField,iInd);
SENDKEY(KeyEnter);
Q_CHECK_CURRENT_FORM(sToForm,"Unable to navigate to " + sToForm);
}
/* If not found, check whether the nominated more records indicator field is present on the screen. If it is we can page down. */
/* Note the payload accompanying the Sendkey. It is used in the vHandleArrive function to decide whether we have to repeat this logic. */
else if ( CHECK_FIELD_EXISTS(sMoreRecsField) )
{
SENDKEY(KeyPageDown, "Next_Page");
}
}
ケース B:選択肢が見つかったときに、該当する行にカーソルを設定し、セレクター・フィールド "SFL_SELECT" の値を "2" に設定し、Enter を押す。
このケースは、SETCURSOR の呼び出しを除いては、前のケースとほとんど同じです。SETCURSOR を以下の記述に置き換えます。
SETVALUE("SFL_SELECT", "2", iInd);