Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
85
UltraGridAction.AboveCell Moves LEFT and UltraGridAction.BelowCell Moves RIGHT
posted

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? 

Parents
No Data
Reply
  • 5
    posted

    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

     

    Private Sub UltraGrid1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles UltraGrid1.KeyDown

    Select Case e.KeyCode

    Case Keys.Up

    Me.UltraGrid1.PerformAction(UltraGridAction.ExitEditMode, False, False)

    Dim save_active_cell_index As Integer = Me.UltraGrid1.ActiveCell.Column.Index

    If Me.UltraGrid1.ActiveRow.Index > 0 Then

    Me.UltraGrid1.ActiveRow = Me.UltraGrid1.Rows(Me.UltraGrid1.ActiveRow.Index - 1)

    Me.UltraGrid1.ActiveCell = Me.UltraGrid1.ActiveRow.Cells(save_active_cell_index)

    End If

    e.Handled = True

    Me.UltraGrid1.PerformAction(UltraGridAction.EnterEditMode, False, False)

    Case Keys.Down

    Me.UltraGrid1.PerformAction(UltraGridAction.ExitEditMode, False, False)

    Dim save_active_cell_index As Integer = Me.UltraGrid1.ActiveCell.Column.Index

    If Me.UltraGrid1.ActiveRow.Index < Me.UltraGrid1.Rows.Count Then

    Me.UltraGrid1.ActiveRow = Me.UltraGrid1.Rows(Me.UltraGrid1.ActiveRow.Index + 1)

    Me.UltraGrid1.ActiveCell = Me.UltraGrid1.ActiveRow.Cells(save_active_cell_index)

    End If

    e.Handled = True

    Me.UltraGrid1.PerformAction(UltraGridAction.EnterEditMode, False, False)

    Case Keys.Right

    Me.UltraGrid1.PerformAction(UltraGridAction.ExitEditMode, False, False)

    Me.UltraGrid1.PerformAction(UltraGridAction.NextCellByTab, False, False)

    e.Handled = True

    Me.UltraGrid1.PerformAction(UltraGridAction.EnterEditMode, False, False)

    Case Keys.Left

    Me.UltraGrid1.PerformAction(UltraGridAction.ExitEditMode, False, False)

    Me.UltraGrid1.PerformAction(UltraGridAction.PrevCellByTab, False, False)

    e.Handled = True

    Me.UltraGrid1.PerformAction(UltraGridAction.EnterEditMode, False, False)

    End Select

Children
No Data