LeaveEditイベントで、セル型の変更が反映されない場合がある
対象製品
El Tabelle for .NET 3.0J
発生環境
この現象は 次のファイルバージョンのアセンブリで発生します。
v3.0.2005.0204
v3.0.2005.0218 (HotFix)
v3.0.2005.0310 (HotFix)
v3.0.2005.0415 (HotFix)
v3.0.2005.0610 (HotFix)
v3.0.2005.0204
v3.0.2005.0218 (HotFix)
v3.0.2005.0310 (HotFix)
v3.0.2005.0415 (HotFix)
v3.0.2005.0610 (HotFix)
状況
修正済み
詳細
Sheet.LeaveEdit、Sheet.EnterEdit イベントで TextEditor.MaxLength プロパティを切り替える処理を行うと、設定が反映されない場合があります。
以下のコードでは、一度目の LeaveEdit イベントの処理では正常に 10 桁の値がセットされますが、二度目の LeaveEdit イベントの処理では 4 桁までしかセットされません。
[Visual Basic]
Private Sub MultiRowSheet1_EnterEdit(ByVal sender As Object, ByVal e As GrapeCity.Win.ElTabelle.MEnterEditEventArgs) Handles MultiRowSheet1.EnterEdit
If TypeOf MultiRowSheet1.ActiveCell.Editor Is GrapeCity.Win.ElTabelle.Editors.TextEditor Then
Dim objTextEditor As GrapeCity.Win.ElTabelle.Editors.TextEditor = _
CType(MultiRowSheet1.ActiveCell.Editor, GrapeCity.Win.ElTabelle.Editors.TextEditor)
objTextEditor.MaxLength = 4
MultiRowSheet1.ActiveCell.Editor = objTextEditor
End If
End Sub
Private Sub MultiRowSheet1_LeaveEdit(ByVal sender As Object, ByVal e As GrapeCity.Win.ElTabelle.MLeaveEditEventArgs) Handles MultiRowSheet1.LeaveEdit
If TypeOf MultiRowSheet1.ActiveCell.Editor Is GrapeCity.Win.ElTabelle.Editors.TextEditor Then
Dim objTextEditor As GrapeCity.Win.ElTabelle.Editors.TextEditor = _
CType(MultiRowSheet1.ActiveCell.Editor, GrapeCity.Win.ElTabelle.Editors.TextEditor)
objTextEditor.MaxLength = 10
MultiRowSheet1.ActiveCell.Editor = objTextEditor
End If
MultiRowSheet1.ActiveCell.Text = "1234567890"
End Sub
[C#]
private void multiRowSheet1_LeaveEdit(object sender, GrapeCity.Win.ElTabelle.MLeaveEditEventArgs e)
{
if((this.multiRowSheet1.ActiveCell.Editor as GrapeCity.Win.ElTabelle.Editors.TextEditor) != null)
{
GrapeCity.Win.ElTabelle.Editors.TextEditor objTextEditor =
(GrapeCity.Win.ElTabelle.Editors.TextEditor)this.multiRowSheet1.ActiveCell.Editor;
objTextEditor.MaxLength =10;
this.multiRowSheet1.ActiveCell.Editor = objTextEditor;
}
this.multiRowSheet1.ActiveCell.Text = "1234567890";
}
private void multiRowSheet1_EnterEdit(object sender, GrapeCity.Win.ElTabelle.MEnterEditEventArgs e)
{
if((this.multiRowSheet1.ActiveCell.Editor as GrapeCity.Win.ElTabelle.Editors.TextEditor) != null)
{
GrapeCity.Win.ElTabelle.Editors.TextEditor objTextEditor =
(GrapeCity.Win.ElTabelle.Editors.TextEditor)this.multiRowSheet1.ActiveCell.Editor;
objTextEditor.MaxLength =4;
this.multiRowSheet1.ActiveCell.Editor = objTextEditor;
}
}
・この現象は WorkBook/Sheet および MultiRowSheet の両方で発生します。
以下のコードでは、一度目の LeaveEdit イベントの処理では正常に 10 桁の値がセットされますが、二度目の LeaveEdit イベントの処理では 4 桁までしかセットされません。
[Visual Basic]
Private Sub MultiRowSheet1_EnterEdit(ByVal sender As Object, ByVal e As GrapeCity.Win.ElTabelle.MEnterEditEventArgs) Handles MultiRowSheet1.EnterEdit
If TypeOf MultiRowSheet1.ActiveCell.Editor Is GrapeCity.Win.ElTabelle.Editors.TextEditor Then
Dim objTextEditor As GrapeCity.Win.ElTabelle.Editors.TextEditor = _
CType(MultiRowSheet1.ActiveCell.Editor, GrapeCity.Win.ElTabelle.Editors.TextEditor)
objTextEditor.MaxLength = 4
MultiRowSheet1.ActiveCell.Editor = objTextEditor
End If
End Sub
Private Sub MultiRowSheet1_LeaveEdit(ByVal sender As Object, ByVal e As GrapeCity.Win.ElTabelle.MLeaveEditEventArgs) Handles MultiRowSheet1.LeaveEdit
If TypeOf MultiRowSheet1.ActiveCell.Editor Is GrapeCity.Win.ElTabelle.Editors.TextEditor Then
Dim objTextEditor As GrapeCity.Win.ElTabelle.Editors.TextEditor = _
CType(MultiRowSheet1.ActiveCell.Editor, GrapeCity.Win.ElTabelle.Editors.TextEditor)
objTextEditor.MaxLength = 10
MultiRowSheet1.ActiveCell.Editor = objTextEditor
End If
MultiRowSheet1.ActiveCell.Text = "1234567890"
End Sub
[C#]
private void multiRowSheet1_LeaveEdit(object sender, GrapeCity.Win.ElTabelle.MLeaveEditEventArgs e)
{
if((this.multiRowSheet1.ActiveCell.Editor as GrapeCity.Win.ElTabelle.Editors.TextEditor) != null)
{
GrapeCity.Win.ElTabelle.Editors.TextEditor objTextEditor =
(GrapeCity.Win.ElTabelle.Editors.TextEditor)this.multiRowSheet1.ActiveCell.Editor;
objTextEditor.MaxLength =10;
this.multiRowSheet1.ActiveCell.Editor = objTextEditor;
}
this.multiRowSheet1.ActiveCell.Text = "1234567890";
}
private void multiRowSheet1_EnterEdit(object sender, GrapeCity.Win.ElTabelle.MEnterEditEventArgs e)
{
if((this.multiRowSheet1.ActiveCell.Editor as GrapeCity.Win.ElTabelle.Editors.TextEditor) != null)
{
GrapeCity.Win.ElTabelle.Editors.TextEditor objTextEditor =
(GrapeCity.Win.ElTabelle.Editors.TextEditor)this.multiRowSheet1.ActiveCell.Editor;
objTextEditor.MaxLength =4;
this.multiRowSheet1.ActiveCell.Editor = objTextEditor;
}
}
・この現象は WorkBook/Sheet および MultiRowSheet の両方で発生します。
回避方法
この現象はファイル バージョン v3.1.2005.0615 以降のアセンブリで修正されています。
修正版は こちら からダウンロードできます。
また、次の操作を行うことで現象を回避できます。
次のように、アクティブセルに対応するシートのセルにも設定を適用することで現象を回避できます。
[C#]
private void multiRowSheet1_LeaveEdit(object sender, GrapeCity.Win.ElTabelle.MLeaveEditEventArgs e)
{
if((this.multiRowSheet1.ActiveCell.Editor as GrapeCity.Win.ElTabelle.Editors.TextEditor) != null)
{
GrapeCity.Win.ElTabelle.Editors.TextEditor objTextEditor =
(GrapeCity.Win.ElTabelle.Editors.TextEditor)this.multiRowSheet1.ActiveCell.Editor;
objTextEditor.MaxLength =10;
this.multiRowSheet1.ActiveCell.Editor = objTextEditor;
//追加コード
this.multiRowSheet1[this.multiRowSheet1.ActivePosition.MRow,
this.multiRowSheet1.ActivePosition.Column, this.multiRowSheet1.ActivePosition.Row].Editor = objTextEditor;
}
this.multiRowSheet1.ActiveCell.Text = "1234567890";
}
修正版は こちら からダウンロードできます。
また、次の操作を行うことで現象を回避できます。
次のように、アクティブセルに対応するシートのセルにも設定を適用することで現象を回避できます。
[C#]
private void multiRowSheet1_LeaveEdit(object sender, GrapeCity.Win.ElTabelle.MLeaveEditEventArgs e)
{
if((this.multiRowSheet1.ActiveCell.Editor as GrapeCity.Win.ElTabelle.Editors.TextEditor) != null)
{
GrapeCity.Win.ElTabelle.Editors.TextEditor objTextEditor =
(GrapeCity.Win.ElTabelle.Editors.TextEditor)this.multiRowSheet1.ActiveCell.Editor;
objTextEditor.MaxLength =10;
this.multiRowSheet1.ActiveCell.Editor = objTextEditor;
//追加コード
this.multiRowSheet1[this.multiRowSheet1.ActivePosition.MRow,
this.multiRowSheet1.ActivePosition.Column, this.multiRowSheet1.ActivePosition.Row].Editor = objTextEditor;
}
this.multiRowSheet1.ActiveCell.Text = "1234567890";
}
キーワード
ELTB04770
この文書は、以前は次のバグレポートIDで公開されていました : 4974