Add Row through keyboard

Posted by: chrisjoo12 on 8 September 2017, 2:51 pm EST

  • Posted 8 September 2017, 2:51 pm EST

    hi... 

    1. Is it possible to add / delete active row  through the keyboard shortcut(eg. INS & DEL key)?? 

    2. i'll try to delete multi-row .. 

    for(int i=0;i

       if ( checkbox) 

     //  delete row .. 

    spread1.ActiveSheet.Rows.Remove(i, 1); 

    }  

     but,  if ith row deleted, next row index decrease 1 row index.

    how to solve it ??

    thanks .  

     

     

     

  • Replied 8 September 2017, 2:51 pm EST

    You can map keys to what ever action you would like them to take.





    Changing the Default Keyboard
    Map


    The default input map defines the behavior of the component for end user
    interaction with the keyboard. For example, by default, when the end user
    presses the Enter key in an active cell, the edit mode turns on for that cell.
    You can change this default behavior, by changing the default input map. To
    continue with this example, you can change the behavior so that pressing the
    Enter key moves the active cell to the next row.


    Return to the overview of Managing Keyboard
    Interaction
    .




      Example 1: Changing Enter Key


      [C#]


      private void Form1_Load(object sender, System.EventArgs e)


      {



      FarPoint.Win.Spread.InputMap im = new
      FarPoint.Win.Spread.InputMap();



      // Define the operation of pressing Enter key in cells not
      being edited as "Move to the next row".


      im =
      fpSpread1.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenFocused);


      im.Put(new FarPoint.Win.Spread.Keystroke(Keys.Enter,
      Keys.None), FarPoint.Win.Spread.SpreadActions.MoveToNextRow);



      // Define the operation of pressing Enter key in cells being
      edited as "Move to the next row".


      im =
      fpSpread1.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenAncestorOfFocused);


      im.Put(new FarPoint.Win.Spread.Keystroke(Keys.Enter,
      Keys.None), FarPoint.Win.Spread.SpreadActions.MoveToNextRow);



      }


      [Visual Basic]


      Private Sub Form1_Load(ByVal sender As Object, ByVal e As
      System.EventArgs) Handles MyBase.Load



      Dim im As New FarPoint.Win.Spread.InputMap



      ' Define the operation of pressing Enter key in cells not
      being edited as "Move to the next row".


      im =
      FpSpread1.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenFocused)


      im.Put(New FarPoint.Win.Spread.Keystroke(Keys.Enter,
      Keys.None), FarPoint.Win.Spread.SpreadActions.MoveToNextRow)



      ' Define the operation of pressing Enter key in cells being
      edited as "Move to the next row".


      im =
      FpSpread1.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenAncestorOfFocused)


      im.Put(New FarPoint.Win.Spread.Keystroke(Keys.Enter,
      Keys.None), FarPoint.Win.Spread.SpreadActions.MoveToNextRow)



      End Sub

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels