CellNotify イベントで EditState プロパティを変更すると例外が発生する
対象製品
El Tabelle for .NET 3.0J
発生環境
この現象は 次のファイルバージョンのアセンブリで発生します。
v3.0.2005.0610 (HotFix)
v3.1.2005.0615
v3.0.2005.0610 (HotFix)
v3.1.2005.0615
状況
修正済み
詳細
チェックボックス型セルの値を変更した直後に、セルを直ちに移動可能にするために Sheet.EditState プロパティを使用して編集を確定すると、例外が発生します。
[Visual Basic]
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Sheet1(0, 0).Editor = New GrapeCity.Win.ElTabelle.Editors.CheckBoxEditor
End Sub
Private Sub Sheet1_CellNotify(ByVal sender As Object, ByVal e As GrapeCity.Win.ElTabelle.CellNotifyEventArgs) Handles Sheet1.CellNotify
If e.Name = GrapeCity.Win.ElTabelle.CellNotifyEvents.CheckedChanged Then
Sheet1.EditState = False
End If
End Sub
[Visual Basic]
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Sheet1(0, 0).Editor = New GrapeCity.Win.ElTabelle.Editors.CheckBoxEditor
End Sub
Private Sub Sheet1_CellNotify(ByVal sender As Object, ByVal e As GrapeCity.Win.ElTabelle.CellNotifyEventArgs) Handles Sheet1.CellNotify
If e.Name = GrapeCity.Win.ElTabelle.CellNotifyEvents.CheckedChanged Then
Sheet1.EditState = False
End If
End Sub
回避方法
この現象はファイル バージョン v3.1.2005.0706 以降のアセンブリで修正されています。
修正版は こちら からダウンロードできます。
また、次の操作を行うことで現象を回避できます。
Sheet.CellNotify イベントと Sheet.EditState プロパティを使用するのではなく、一時的に常時入力モードを使用することで回避できます。
[Visual Basic]
Private Sub Sheet1_EnteredCell(ByVal sender As Object, ByVal e As System.EventArgs) Handles Sheet1.EnteredCell
'チェックボックス型セルの場合
If TypeOf Sheet1.ActiveCell.Editor Is GrapeCity.Win.ElTabelle.Editors.CheckBoxEditor Then
'常時入力モードを有効にする
Sheet1.ExitOnArrows = True
Sheet1.EditType = GrapeCity.Win.ElTabelle.EditType.AlwaysEdit
End If
End Sub
Private Sub Sheet1_LeaveCell(ByVal sender As Object, ByVal e As GrapeCity.Win.ElTabelle.LeaveCellEventArgs) Handles Sheet1.LeaveCell
'移動先のセルがチェックボックス型以外の場合
Sheet1.CellPosition = e.NewPosition
If Not TypeOf Sheet1.CellEditor Is GrapeCity.Win.ElTabelle.Editors.CheckBoxEditor Then
'常時入力モードを無効にする
Sheet1.ExitOnArrows = False
Sheet1.EditType = GrapeCity.Win.ElTabelle.EditType.Default
End If
End Sub
修正版は こちら からダウンロードできます。
また、次の操作を行うことで現象を回避できます。
Sheet.CellNotify イベントと Sheet.EditState プロパティを使用するのではなく、一時的に常時入力モードを使用することで回避できます。
[Visual Basic]
Private Sub Sheet1_EnteredCell(ByVal sender As Object, ByVal e As System.EventArgs) Handles Sheet1.EnteredCell
'チェックボックス型セルの場合
If TypeOf Sheet1.ActiveCell.Editor Is GrapeCity.Win.ElTabelle.Editors.CheckBoxEditor Then
'常時入力モードを有効にする
Sheet1.ExitOnArrows = True
Sheet1.EditType = GrapeCity.Win.ElTabelle.EditType.AlwaysEdit
End If
End Sub
Private Sub Sheet1_LeaveCell(ByVal sender As Object, ByVal e As GrapeCity.Win.ElTabelle.LeaveCellEventArgs) Handles Sheet1.LeaveCell
'移動先のセルがチェックボックス型以外の場合
Sheet1.CellPosition = e.NewPosition
If Not TypeOf Sheet1.CellEditor Is GrapeCity.Win.ElTabelle.Editors.CheckBoxEditor Then
'常時入力モードを無効にする
Sheet1.ExitOnArrows = False
Sheet1.EditType = GrapeCity.Win.ElTabelle.EditType.Default
End If
End Sub
キーワード
ELTB04846
この文書は、以前は次のバグレポートIDで公開されていました : 4983