コンボボックス型セルのEditorValueプロパティをEditorValue.ItemDataに設定した場合、ComboSelChangeおよびComboCloseUpイベント内でセルの値がNothingになることがある

文書番号 : 39055     文書種別 : 不具合     登録日 : 2015/07/27     最終更新日 : 2015/09/29
文書を印刷する
対象製品
SPREAD for Windows Forms 8.0J
状況
修正済み
詳細
コンボボックス型セルのEditorValueプロパティをEditorValue.ItemDataに設定した場合、ドロップダウンリスト内でマウスボタンを押下し、そままドロップダウンリストの外までドラッグしてマウスボタンを解放すると、ComboSelChangeイベントとComboCloseUpイベントでセルの値がNothingになります。

【手順】
1.新規フォームにSPREADを配置します
2.下記サンプルコードをコピーし、アプリケーションを実行します
3.A1セルのコンボボックス型セルで「BBB」を選択し、セルの編集を終了します
4.A1セルのドロップダウンボタンをクリックしてドロップダウンリストを表示します
5.ドロップダウンリストを項目「KKK」が表示されるまでスクロールします
6.項目「KKK」でマウスボタンを押下し、そままドロップダウンリストの外までドラッグしてマウスボタンを解放します
  --「KKK」が選択されません
  --ComboSelChangeイベントとComboCloseUpイベントでセルの値がNothingになります

【サンプルコード】
  Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    ' データの作成
    Dim items As String() = New String(19) {}
    Dim itemData As String() = New String(19) {}
    For i As Integer = 0 To items.Length - 1
      items(i) = String.Format("{0}{0}{0}", Chr(Asc("A") + i))
      itemData(i) = String.Format("{0}", Chr(Asc("A") + i))
    Next

    ' コンボボックス型セルの設定:ItemDataを使用
    Dim combo1 As New FarPoint.Win.Spread.CellType.ComboBoxCellType()
    combo1.Items = items
    combo1.ItemData = itemData
    combo1.EditorValue = FarPoint.Win.Spread.CellType.EditorValue.ItemData
    FpSpread1.ActiveSheet.Cells(0, 0).CellType = combo1

    ' コンボボックス型セルの設定:ItemDataを未使用
    Dim combo2 As New FarPoint.Win.Spread.CellType.ComboBoxCellType()
    combo2.Items = items
    FpSpread1.ActiveSheet.Cells(0, 1).CellType = combo2
  End Sub

  Private Sub FpSpread1_ComboDropDown(sender As Object, e As FarPoint.Win.Spread.EditorNotifyEventArgs) Handles FpSpread1.ComboDropDown
    Dim cell1 As FarPoint.Win.Spread.Cell = e.View.GetSheetView().ActiveCell
    Dim cell2 As FarPoint.Win.Spread.Cell = e.View.GetSheetView().Cells(e.Row, e.Column)
    Console.WriteLine("----------")
    Console.WriteLine("ComboDropDown: col={0} value1={1} text1={2} value2={3} editor={4}", e.Column, cell1.Value, cell1.Text, cell2.Value, e.EditingControl.Text)
  End Sub

  Private Sub FpSpread1_ComboSelChange(sender As Object, e As FarPoint.Win.Spread.EditorNotifyEventArgs) Handles FpSpread1.ComboSelChange
    Dim cell1 As FarPoint.Win.Spread.Cell = e.View.GetSheetView().ActiveCell
    Dim cell2 As FarPoint.Win.Spread.Cell = e.View.GetSheetView().Cells(e.Row, e.Column)
    Console.WriteLine("ComboSelChange: col={0} value1={1} text1={2} value2={3} editor={4}", e.Column, cell1.Value, cell1.Text, cell2.Value, e.EditingControl.Text)
  End Sub

  Private Sub FpSpread1_ComboCloseUp(sender As Object, e As FarPoint.Win.Spread.EditorNotifyEventArgs) Handles FpSpread1.ComboCloseUp
    Dim cell1 As FarPoint.Win.Spread.Cell = e.View.GetSheetView().ActiveCell
    Dim cell2 As FarPoint.Win.Spread.Cell = e.View.GetSheetView().Cells(e.Row, e.Column)
    Console.WriteLine("ComboCloseUp: col={0} value1={1} text1={2} value2={3} editor={4}", e.Column, cell1.Value, cell1.Text, cell2.Value, e.EditingControl.Text)
  End Sub
回避方法
Service Pack 1(v8.0.3502.2008)で修正済み。