I'm trapping the _KeyDown event on an UltraGrid with the following code:
private void ucDataGridComponent_KeyDown(object sender, KeyEventArgs e) { switch (e.KeyCode) { case Keys.Up: this.PerformAction(UltraGridAction.ExitEditMode, false, false); this.PerformAction(UltraGridAction.AboveCell, false, false); e.Handled = true; this.PerformAction(UltraGridAction.EnterEditMode, false, false); break; case Keys.Down: this.PerformAction(UltraGridAction.ExitEditMode, false, false); this.PerformAction(UltraGridAction.BelowCell, false, false); e.Handled = true; this.PerformAction(UltraGridAction.EnterEditMode, false, false); break; case Keys.Right: this.PerformAction(UltraGridAction.ExitEditMode, false, false); this.PerformAction(UltraGridAction.NextCellByTab, false, false); e.Handled = true; this.PerformAction(UltraGridAction.EnterEditMode, false, false); break; case Keys.Left: this.PerformAction(UltraGridAction.ExitEditMode, false, false); this.PerformAction(UltraGridAction.PrevCellByTab, false, false); e.Handled = true; this.PerformAction(UltraGridAction.EnterEditMode, false, false); break; } }
However, Key Down always goes LEFT and Key Up always goes RIGHT. Can someone tell me why?
I've found a workaround to this problem. By the way, it has not been fixed in Netadvantage 2008 2.0
Linda Jaeger
jaegerl@transcontinental.ca
Select Case e.KeyCode
Me.UltraGrid1.PerformAction(UltraGridAction.ExitEditMode, False, False)
If Me.UltraGrid1.ActiveRow.Index > 0 Then
Me.UltraGrid1.ActiveCell = Me.UltraGrid1.ActiveRow.Cells(save_active_cell_index)
End If
e.Handled = True
Case Keys.Down
Dim save_active_cell_index As Integer = Me.UltraGrid1.ActiveCell.Column.Index
If Me.UltraGrid1.ActiveRow.Index < Me.UltraGrid1.Rows.Count Then
Case Keys.Right
Me.UltraGrid1.PerformAction(UltraGridAction.NextCellByTab, False, False)
Case Keys.Left
Me.UltraGrid1.PerformAction(UltraGridAction.PrevCellByTab, False, False)
End Select