LengthAsByte プロパティと常時入力モードの組み合わせで右方向のセルに移動できない
対象製品
El Tabelle for .NET 2.0J
発生環境
・この現象は次のファイル バージョンのアセンブリで発生します。
v2.0.2004.0304
v2.0.2004.0324 (HotFix)
v2.0.2004.0521
v2.0.2004.0304
v2.0.2004.0324 (HotFix)
v2.0.2004.0521
状況
修正済み
詳細
文字列型セル(TextEditor)の LengthAsByte プロパティと常時入力モードの組み合わせで右方向のセルに移動できない場合があります。
再現条件
・Sheet の EditType プロパティを AlwaysEdit に設定する
・Sheet の ExitOnArrows プロパティを true に設定する
・任意のセルを文字列型に設定し、LengthAsByte プロパティを true に設定する
以上の設定で、文字列型セルのテキスト(Sheet.ActiveCell.Text)に2バイト文字が
含まれるとき、矢印キーの操作で右のセルに移動できません。
・この現象は、1バイト文字だけのデータでは発生しません。
・この現象は、El Tabelle for .NET (1.0) では発生しません。(LengthAsByte プロパティが存在しないため)
再現条件
・Sheet の EditType プロパティを AlwaysEdit に設定する
・Sheet の ExitOnArrows プロパティを true に設定する
・任意のセルを文字列型に設定し、LengthAsByte プロパティを true に設定する
以上の設定で、文字列型セルのテキスト(Sheet.ActiveCell.Text)に2バイト文字が
含まれるとき、矢印キーの操作で右のセルに移動できません。
・この現象は、1バイト文字だけのデータでは発生しません。
・この現象は、El Tabelle for .NET (1.0) では発生しません。(LengthAsByte プロパティが存在しないため)
回避方法
この現象はファイル バージョン v2.0.2004.0629 以降のアセンブリで修正されています。
修正版は こちら からダウンロードできます。
また、次の操作を行うことで現象を回避できます。
・KeyDown イベントに代替処理を記述します。
[Visual Basic]
Private Sub Sheet1_KeyDown(ByVal sender As Object, _
ByVal e As System.Windows.Forms.KeyEventArgs) Handles Sheet1.KeyDown
Select Case e.KeyCode
Case Keys.Right
If TypeOf Sheet1.ActiveCell.Editor _
Is GrapeCity.Win.ElTabelle.Editors.TextEditor Then
Dim objTextEditor As GrapeCity.Win.ElTabelle.Editors.TextEditor
objTextEditor = CType(Sheet1.ActiveCell.Editor, _
GrapeCity.Win.ElTabelle.Editors.TextEditor)
If objTextEditor.LengthAsByte = True Then
If objTextEditor.SelectionLength = Sheet1.ActiveCell.Text.Length Then
Sheet1.ActivePosition = New GrapeCity.Win.ElTabelle.Position( _
Sheet1.ActivePosition.Column + 1, Sheet1.ActivePosition.Row)
e.Handled = True
ElseIf objTextEditor.CursorPosition = Sheet1.ActiveCell.Text.Length Then
Sheet1.ActivePosition = New GrapeCity.Win.ElTabelle.Position( _
Sheet1.ActivePosition.Column + 1, Sheet1.ActivePosition.Row)
e.Handled = True
End If
End If
End If
End Select
End Sub
[C#]
private void sheet1_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
{
if((sheet1.ActiveCell.Editor as GrapeCity.Win.ElTabelle.Editors.TextEditor) != null)
{
GrapeCity.Win.ElTabelle.Editors.TextEditor objTextEditor;
objTextEditor = (GrapeCity.Win.ElTabelle.Editors.TextEditor)sheet1.ActiveCell.Editor;
if(objTextEditor.LengthAsByte == true)
{
if(objTextEditor.SelectionLength == sheet1.ActiveCell.Text.Length)
{
sheet1.ActivePosition = new GrapeCity.Win.ElTabelle.Position(sheet1.ActivePosition.Column + 1, sheet1.ActivePosition.Row);
e.Handled = true;
}
else if(objTextEditor.CursorPosition == sheet1.ActiveCell.Text.Length)
{
sheet1.ActivePosition = new GrapeCity.Win.ElTabelle.Position(sheet1.ActivePosition.Column + 1, sheet1.ActivePosition.Row);
e.Handled = true;
}
}
if(e.KeyCode == Keys.Left)
{
sheet1.ActivePosition = new GrapeCity.Win.ElTabelle.Position(sheet1.ActivePosition.Column - 1,sheet1.ActivePosition.Row);
}
}
}
修正版は こちら からダウンロードできます。
また、次の操作を行うことで現象を回避できます。
・KeyDown イベントに代替処理を記述します。
[Visual Basic]
Private Sub Sheet1_KeyDown(ByVal sender As Object, _
ByVal e As System.Windows.Forms.KeyEventArgs) Handles Sheet1.KeyDown
Select Case e.KeyCode
Case Keys.Right
If TypeOf Sheet1.ActiveCell.Editor _
Is GrapeCity.Win.ElTabelle.Editors.TextEditor Then
Dim objTextEditor As GrapeCity.Win.ElTabelle.Editors.TextEditor
objTextEditor = CType(Sheet1.ActiveCell.Editor, _
GrapeCity.Win.ElTabelle.Editors.TextEditor)
If objTextEditor.LengthAsByte = True Then
If objTextEditor.SelectionLength = Sheet1.ActiveCell.Text.Length Then
Sheet1.ActivePosition = New GrapeCity.Win.ElTabelle.Position( _
Sheet1.ActivePosition.Column + 1, Sheet1.ActivePosition.Row)
e.Handled = True
ElseIf objTextEditor.CursorPosition = Sheet1.ActiveCell.Text.Length Then
Sheet1.ActivePosition = New GrapeCity.Win.ElTabelle.Position( _
Sheet1.ActivePosition.Column + 1, Sheet1.ActivePosition.Row)
e.Handled = True
End If
End If
End If
End Select
End Sub
[C#]
private void sheet1_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
{
if((sheet1.ActiveCell.Editor as GrapeCity.Win.ElTabelle.Editors.TextEditor) != null)
{
GrapeCity.Win.ElTabelle.Editors.TextEditor objTextEditor;
objTextEditor = (GrapeCity.Win.ElTabelle.Editors.TextEditor)sheet1.ActiveCell.Editor;
if(objTextEditor.LengthAsByte == true)
{
if(objTextEditor.SelectionLength == sheet1.ActiveCell.Text.Length)
{
sheet1.ActivePosition = new GrapeCity.Win.ElTabelle.Position(sheet1.ActivePosition.Column + 1, sheet1.ActivePosition.Row);
e.Handled = true;
}
else if(objTextEditor.CursorPosition == sheet1.ActiveCell.Text.Length)
{
sheet1.ActivePosition = new GrapeCity.Win.ElTabelle.Position(sheet1.ActivePosition.Column + 1, sheet1.ActivePosition.Row);
e.Handled = true;
}
}
if(e.KeyCode == Keys.Left)
{
sheet1.ActivePosition = new GrapeCity.Win.ElTabelle.Position(sheet1.ActivePosition.Column - 1,sheet1.ActivePosition.Row);
}
}
}
キーワード
ELTB03953
この文書は、以前は次のバグレポートIDで公開されていました : 4037