ナレッジベース
ImNumber型セルで数値の符号を切り替えると、値が 0 になり文字列の選択状態が解除される
対象製品
MultiRow for ASP.NET 1.0J
ステータス
回避方法あり
詳細
セルが編集状態で文字列が選択されている時に [+]または[-]キーを押下して数値の符号を変更すると、数値が 0 になり、文字列の選択状態が解除されます。
ImNumber型セルでは、[+]または[-]キーは符号の切り替えを行います。よって、文字列が選択されている状態でこれらのキーを押下されたときの正しい動作は、文字列の選択状態は維持され数値の絶対値は変化せず、符号だけが切り替わります。
<例>
1. 値 100 が設定されたセルを編集モードにし、文字列「100」を選択状態(ハイライト表示)にします。
2. [-]キーを押下すると数値が 0 になり、文字列の選択状態は解除されます。
正しくは、「-100」という数値で「100」が選択状態になります。
ImNumber型セルでは、[+]または[-]キーは符号の切り替えを行います。よって、文字列が選択されている状態でこれらのキーを押下されたときの正しい動作は、文字列の選択状態は維持され数値の絶対値は変化せず、符号だけが切り替わります。
<例>
1. 値 100 が設定されたセルを編集モードにし、文字列「100」を選択状態(ハイライト表示)にします。
2. [-]キーを押下すると数値が 0 になり、文字列の選択状態は解除されます。
正しくは、「-100」という数値で「100」が選択状態になります。
回避方法
以下の回避スクリプトHookImNumberUIProcessMethods()をページのonloadイベントで呼び出すことで回避できます。
[JavaScript]
<head runat="server">
<script language="javascript" type="text/javascript">
function HookImNumberUIProcessMethods() {
if (ImNumberUIProcess != null && ImNumberUIProcess.prototype.SetFix != null) {
ImNumberUIProcess.prototype.__oldSetFix = ImNumberUIProcess.prototype.SetFix;
ImNumberUIProcess.prototype.SetFix = ImNumberUIProcessSetFixWrapper;
}
if (ImNumberUIProcess != null && ImNumberUIProcess.prototype.KeyDown != null) {
ImNumberUIProcess.prototype.__oldKeyDown = ImNumberUIProcess.prototype.KeyDown;
ImNumberUIProcess.prototype.KeyDown = ImNumberUIProcessKeyDownWrapper;
}
}
function ImNumberUIProcessSetFixWrapper(start, length, sign) {
var result = ImNumberUIProcess.prototype.__oldSetFix.call(this, start, length, sign);
if (ImNumberUIProcess.__hasSelection) {
result.SelectionEnd = this.ShowText().length - result.SelectionStart + 1;
}
return result;
}
function ImNumberUIProcessKeyDownWrapper(data) {
if (data.KeyCode == 109 || data.KeyCode == 189 || data.KeyCode == 65723 || data.KeyCode == 107) {
if (data.SelectionEnd - data.SelectionStart > 0) {
ImNumberUIProcess.__hasSelection = true;
data.SelectionEnd = data.SelectionStart;
}
}
var result = ImNumberUIProcess.prototype.__oldKeyDown.call(this, data);
if (ImNumberUIProcess.__hasSelection) {
ImNumberUIProcess.__hasSelection = undefined;
}
return result;
}
</script>
</head>
<body onload="HookImNumberUIProcessMethods()">
[JavaScript]
<head runat="server">
<script language="javascript" type="text/javascript">
function HookImNumberUIProcessMethods() {
if (ImNumberUIProcess != null && ImNumberUIProcess.prototype.SetFix != null) {
ImNumberUIProcess.prototype.__oldSetFix = ImNumberUIProcess.prototype.SetFix;
ImNumberUIProcess.prototype.SetFix = ImNumberUIProcessSetFixWrapper;
}
if (ImNumberUIProcess != null && ImNumberUIProcess.prototype.KeyDown != null) {
ImNumberUIProcess.prototype.__oldKeyDown = ImNumberUIProcess.prototype.KeyDown;
ImNumberUIProcess.prototype.KeyDown = ImNumberUIProcessKeyDownWrapper;
}
}
function ImNumberUIProcessSetFixWrapper(start, length, sign) {
var result = ImNumberUIProcess.prototype.__oldSetFix.call(this, start, length, sign);
if (ImNumberUIProcess.__hasSelection) {
result.SelectionEnd = this.ShowText().length - result.SelectionStart + 1;
}
return result;
}
function ImNumberUIProcessKeyDownWrapper(data) {
if (data.KeyCode == 109 || data.KeyCode == 189 || data.KeyCode == 65723 || data.KeyCode == 107) {
if (data.SelectionEnd - data.SelectionStart > 0) {
ImNumberUIProcess.__hasSelection = true;
data.SelectionEnd = data.SelectionStart;
}
}
var result = ImNumberUIProcess.prototype.__oldKeyDown.call(this, data);
if (ImNumberUIProcess.__hasSelection) {
ImNumberUIProcess.__hasSelection = undefined;
}
return result;
}
</script>
</head>
<body onload="HookImNumberUIProcessMethods()">
キーワード
MRAP08689


