Spread Windows Forms 7.0 Product Documentation
Changing the Default Keyboard Map
See Also Support Options
Spread Windows Forms 7.0 Product Documentation > Developer's Guide > Managing Keyboard Interaction > Changing the Default Keyboard Map

Glossary Item Box

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.

Example 1: Changing Enter Key

C# Copy Code
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);
}
VB Copy Code
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

Example 2: Deactivating F2 Key

C# Copy Code
private void Form1_Load(object sender, System.EventArgs e)
{
   FarPoint.Win.Spread.InputMap im = new FarPoint.Win.Spread.InputMap();
   
   // Deactivate F2 key in cells not being edited.
   im = fpSpread1.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenFocused);
   im.Put(new FarPoint.Win.Spread.Keystroke(Keys.F2, Keys.None), FarPoint.Win.Spread.SpreadActions.None);
   
   // Deactivate F2 key in cells being edited.
   im = fpSpread1.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenAncestorOfFocused);
im.Put(new FarPoint.Win.Spread.Keystroke(Keys.F2, Keys.None), FarPoint.Win.Spread.SpreadActions.None);
}
VB Copy Code
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
   Dim im As New FarPoint.Win.Spread.InputMap
   ' Deactivate F2 key in cells not being edited.
   im = FpSpread1.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenFocused)
   im.Put(New FarPoint.Win.Spread.Keystroke(Keys.F2, Keys.None), FarPoint.Win.Spread.SpreadActions.None)
   ' Deactivate F2 key in cells being edited.
   im = FpSpread1.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenAncestorOfFocused)
   im.Put(New FarPoint.Win.Spread.Keystroke(Keys.F2, Keys.None), FarPoint.Win.Spread.SpreadActions.None)
End Sub

See Also

© 2002-2014 ComponentOne, a division of GrapeCity. All Rights Reserved.