LeaveEditイベントで、セル型の変更が反映されない場合がある

文書番号 : 20144     文書種別 : 不具合     最終更新日 : 2006/02/28
文書を印刷する
対象製品
El Tabelle for .NET 2.0J
発生環境
すべてのアセンブリ
状況
修正済み
詳細
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;
  }
}
回避方法
この現象はファイル バージョン v2.0.2006.0126 以降のアセンブリで修正されています。

修正版は こちら からダウンロードできます。

また、次の操作を行うことで現象を回避できます。

次のように、アクティブセルに対応するシートのセルにも設定を適用することで現象を回避できます。

[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で公開されていました : 5838