←、→のカーソルキーでのセルフォーカス移動を実現したかったのでファンクションのときにやった
Form_Loadのイベントでスプレッドのキーマッピングを変更するようにしてみた
'スプレッド内でファンクションキーのイベントが起きるようにキーマッピングを変更
Dim im As FarPoint.Win.Spread.InputMap
im = Me.spd_明細.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenAncestorOfFocused)
'スプレッドの→キーの割り当てを次の列に移動に変更
im.Put(New FarPoint.Win.Spread.Keystroke(Keys.Right, Keys.None), FarPoint.Win.Spread.SpreadActions.MoveToNextColumnWrap)
'スプレッドの←キーの割り当てを前の列に移動に変更
im.Put(New FarPoint.Win.Spread.Keystroke(Keys.Left, Keys.None), FarPoint.Win.Spread.SpreadActions.MoveToPreviousColumnWrap)
- Download this code: spread25wf_keymap_sample1.txt
を行ってみるが現象は変わらず・・・
調べてみるとGrapeCityのサポートに情報を発見
どうやらCellTypeのAcceptsArrowKeysプロパティを
FarPoint.Win.SuperEdit.AcceptsArrowKeys.AllArrows
に設定してやればいいらしい。
コードで新規テキストセルを作ってしまうとデザイナで設定したものがクリアされてしまうので
初期ルーチンで下のような感じでセルタイプを取得して、キーの設定設定を行い
再度セルタイプに設定値を反映という方法。
←、→キーでのセルフォーカス移動を実現した。
Dim tc As FarPoint.Win.Spread.CellType.TextCellType
Dim nc As FarPoint.Win.Spread.CellType.NumberCellType
Dim intRow As Integer
Dim intCol As Integer
intRow = Me.spd_明細.ActiveSheet.RowCount - 1
Me.spd_明細.SuspendLayout() 'レイアウトロジック一時中断
'各セルにカーソルキーでの移動をセットする
For intCol = 1 To Me.spd_明細.ActiveSheet.ColumnCount - 1
Select Case TypeName(Me.spd_明細.ActiveSheet.Cells(intRow, intCol).CellType)
Case "NumberCellType"
nc = Me.spd_明細.ActiveSheet.Cells(intRow, intCol).CellType
nc.AcceptsArrowKeys = FarPoint.Win.SuperEdit.AcceptsArrowKeys.CtrlArrows
Me.spd_明細.ActiveSheet.Cells(intRow, intCol).CellType = nc
Case "TextCellType"
tc = Me.spd_明細.ActiveSheet.Cells(intRow, intCol).CellType
tc.AcceptsArrowKeys = FarPoint.Win.SuperEdit.AcceptsArrowKeys.CtrlArrows
Me.spd_明細.ActiveSheet.Cells(intRow, intCol).CellType = tc
End Select
Next
Me.spd_明細.ResumeLayout() 'レイアウトをレジューム
- Download this code: spread25wf_keymap_sample2.txt
.NETのSPREADはやっぱり以前より見えない設定が多いな・・・
もう少しデザイナで設定できるとわかりやすいんだけどな。