セルの編集時に左右矢印キーでコンボボックス型セルから移動できない

文書番号 : 39651     文書種別 : 制限事項     登録日 : 2016/11/10     最終更新日 : 2017/11/28
文書を印刷する
対象製品
SPREAD for WPF 1.0J
詳細
本事象は、仕様上の動作となります。
コンボボックス型セルでは、セルが編集中の状態にある場合、左右矢印キーを押してもセルの外にキャレット(フォーカス)が移動することはありません。一方、セルが非編集状態の場合には、左右矢印キーで移動できます。

なお、この動作を変更するには、「回避方法」をご参照ください。

【再現手順】
1. 新規ウィンドウにSPREADを配置します
2. 下記サンプルコードをコピーし、アプリケーションを実行します
3. B1セルのドロップボタンをクリックしてドロップダウンリストを表示します
4. 項目「222」をクリックしてドロップダウンリストを閉じます
5. 右矢印キーを押下します
   --C1セルに移動しません

◎サンプルコード(VB)
Public Sub New()
  ' この呼び出しはデザイナーで必要です。
  InitializeComponent()

  Dim combo As New GrapeCity.Windows.SpreadGrid.ComboBoxCellType()
  combo.Items.Add("111")
  combo.Items.Add("222")
  combo.Items.Add("333")

  GcSpreadGrid1.Columns(1).CellType = combo
End Sub
◎サンプルコード(C#)
public MainWindow()
{
  InitializeComponent();

  GrapeCity.Windows.SpreadGrid.ComboBoxCellType combo = new GrapeCity.Windows.SpreadGrid.ComboBoxCellType();
  combo.Items.Add("111");
  combo.Items.Add("222");
  combo.Items.Add("333");

  GcSpreadGrid1.Columns[1].CellType = combo;
}
回避方法
以下のサンプルコードのように、コンボボックス型セルの方向キーの処理方法を明示的に変更することで、セルの編集時に左右矢印キーでコンボボックス型セルから移動できます。

◎サンプルコード(VB)
Private Sub GcSpreadGrid1_CellEnter(sender As Object, e As SpreadCellEnterEventArgs) Handles GcSpreadGrid1.CellEnter
  If TypeOf GcSpreadGrid1(e.Row, e.Column).InheritedCellType Is GrapeCity.Windows.SpreadGrid.ComboBoxCellType Then
    GcSpreadGrid1.ProcessNavigationKeys = GrapeCity.Windows.SpreadGrid.ProcessNavigationKeys.ExitEditor
  Else
    GcSpreadGrid1.ProcessNavigationKeys = GrapeCity.Windows.SpreadGrid.ProcessNavigationKeys.Default
  End If
End Sub
◎サンプルコード(C#)
private void gcSpreadGrid1_CellEnter(object sender, SpreadCellEnterEventArgs e)
{
  if( gcSpreadGrid1[e.Row, e.Column].InheritedCellType is GrapeCity.Windows.SpreadGrid.ComboBoxCellType )
  {
    gcSpreadGrid1.ProcessNavigationKeys = GrapeCity.Windows.SpreadGrid.ProcessNavigationKeys.ExitEditor;
  }
  else
  {
    gcSpreadGrid1.ProcessNavigationKeys = GrapeCity.Windows.SpreadGrid.ProcessNavigationKeys.Default;
  }
}