Page History
[ |../../index.htm#lansa/lansa050_1655.htm]
現在地: RAMP-TSガイド > プログラミング・テクニック > ファンクション・キーの記述の使用によるRAMPボタンの条件設定 > SHARED.apply5250FunctionKeyPatterns
...
このサンプルJavaScriptファンクションは、指定した画面の行でFn=xxxxxxパターンを検索するように設計されています。下記の追加されたファンクションをコピーし、SHAREDスクリプト・オブジェクト、UF_SY420_RTS.JSファイルに貼り付けます。
Wiki Markup
// Apply Fn=xxxxxx function key patterns to buttons and function keys enabled on the current RAMP-TS screen
...
apply5250FunctionKeyPatterns : function(iLowRow,iHighRow,aForceEnable,aForceDisable)...
{
if (GLOBAL_oAXESInterface == null) return; // No AXES interface
...
if (GLOBAL_oCurrentTSform == null) return; // No current AXES form
...
if (oGLOBAL_CurrentFORM == null) return; // No RAMP-TS definition for the
...
form
TRACE("SHARED.applyFunctionKeyPatterns started");
...
...
if (iHighRow == null) iHighRow = iLowRow; // default is same as low row...
...
var allkeys = "";
...
var typeOUTPUT = GLOBAL_oAXESInterface.Element.TYPE_OUTPUT;
...
var oForm = oGLOBAL_CurrentFORM;
...
...
// Disable all function keys and buttons to start with....
// Note that the function keys (oForm.vFKERTS) and the buttons (oForm.vFKEVLF) are BOTH disabled here
...
TRACE("SHARED.applyFunctionKeyPatterns is disabling all function keys and all buttons");
...
for (var i = 0; i < oForm.vFKEVLF.length; i++)
...
{ if (oForm.vFKEVLF.charAt(i) != "0") oForm.vFKEVLF = InsertString(oForm.vFKEVLF,"0",i); ...
}
for (var i = 0; i < oForm.vFKERTS.length; i++)
...
{ if (oForm.vFKERTS.charAt(i) != "0") oForm.vFKERTS = InsertString(oForm.vFKERTS,"0",i); ...
}
// Strip all output fields on the specified lines to create a long string of function keys strings
...
...
for (var iRow = iLowRow; iRow <= iHighRow; iRow++)...
{
var aAElement = GLOBAL_oCurrentTSform.getElementsByRow(iRow);
...
for (var i = 0; i < aAElement.length; i++)
...
{
var oAXESElement = aAElement
...
[i...
];...
if (oAXESElement.type == typeOUTPUT)
...
{ allkeys += " " + oAXESElement.getValue(); ...
}
...
...
}
}
// This RegExp looks for strings of the form F1=XXXX (where "F" can be F, PF, FP, CF
...
// or Cmd) XXXX can be a string of any length terminating at more than one space,
...
// the end of the line or another instance of "F1=" (thats the ?= look ahead group)....
// All groups are forgotten (that's the ?:) except the function number and the XXXX text.
...
var reFKey = /\b(?:F|PF|FP|CF|Cmd)(\d+)
...
[=-...
](.*?)(?=(?:\b(?:F|PF|FP|CF|Cmd)\d+...
[=-...
])|\s...
{2,...
}|$)/gi;...
var fkeyMatch = reFKey.exec(allkeys);
...
while (fkeyMatch != null)
...
...
{
...
var key = "F" + TRIM_RIGHT(fkeyMatch...
[1...
]);...
// Note that the function key and the button are both being enabled here
...
SETKEYENABLED(GLOBAL_oCurrentTSform.symbolicName,key,true,true);...
...
fkeyMatch = reFKey.exec(allkeys);...
...
}...
...
// Enable any forced buttons. Note that the function key and the button are BOTH enabled
...
...
...
if (aForceEnable != null)
...
...
{
...
TRACE("SHARED.applyFunctionKeyPatterns is forcing the enablement of specified keys/buttons");...
for (var i = 0; i < aForceEnable.length; i++)
...
{ SETKEYENABLED(GLOBAL_oCurrentTSform.symbolicName,aForceEnable...
[i...
],true,true); ...
}
...
...
}...
// Disable any forced buttons. Note that the function key and the button are BOTH disabled
...
...
if (aForceDisable != null)
...
...
{
...
TRACE("SHARED.applyFunctionKeyPatterns is forcing the disablement of specified keys/buttons");
...
for (var i = 0; i < aForceDisable.length; i++)
...
{ SETKEYENABLED(GLOBAL_oCurrentTSform.symbolicName,aForceDisable...
[i...
],false,false); ...
}
...
...
}...
...
// ...
Finished
TRACE("SHARED.applyFunctionKeyPatterns ended");
...
}, // <--- Note the
...
comma