Spread Windows Forms 10.0 Product Documentation > Developer's Guide > Managing Keyboard Interaction > Customizing the Input Maps |
You can use the default navigation keys that are mapped to Spread actions. You can also customize these input maps so that any key or key combination can map to any Spread component action.
Be sure to read Factors of Keyboard Map Usage.
The available actions to which you can map keys or key combinations are provided in the SpreadActions class.
The default maps create the default navigation and action keys listed in Default Keyboard Maps. These maps are for the default operation mode, Normal. Other maps are provided for other operation modes. Be sure to set the map for the operation mode in which your component is working when customizing input maps. For more information about default values of the various modes, refer to Default Keyboard Maps. Input maps work differently depending on the current focus.
For more detailed descriptions of input maps, refer to the InputMap class.
The Properties window does not have options to customize input maps.
This example code sets the input map for operation mode Normal for both the object with focus and its ancestor. This example sets the Enter key to always move to the next row.
C# |
Copy Code
|
---|---|
// Create an InputMap object. FarPoint.Win.Spread.InputMap inputmap1; // Assign the InputMap object to the existing map. inputmap1 = fpSpread1.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenAncestorOfFocused); // Map the Enter key. inputmap1.Put(new FarPoint.Win.Spread.Keystroke(Keys.Enter, Keys.None), FarPoint.Win.Spread.SpreadActions.MoveToNextRow); // Create another InputMap object. FarPoint.Win.Spread.InputMap inputmap2; // Assign this InputMap object to the existing map. inputmap2 = fpSpread1.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenFocused); // Map the Enter key. inputmap2.Put(new FarPoint.Win.Spread.Keystroke(Keys.Enter, Keys.None), FarPoint.Win.Spread.SpreadActions.MoveToNextRow); |
VB |
Copy Code
|
---|---|
' Create an InputMap object. Dim inputmap1 As New FarPoint.Win.Spread.InputMap() ' Assign the InputMap object to the existing map. inputmap1 = FpSpread1.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenAncestorOfFocused) ' Map the Enter key. inputmap1.Put(New FarPoint.Win.Spread.Keystroke(Keys.Enter, Keys.None), FarPoint.Win.Spread.SpreadActions.MoveToNextRow) ' Create another InputMap object. Dim inputmap2 As New FarPoint.Win.Spread.InputMap() ' Assign this InputMap object to the existing map. inputmap2 = FpSpread1.GetInputMap(FarPoint.Win.Spread.InputMapMode.WhenFocused) ' Map the Enter key. inputmap2.Put(New FarPoint.Win.Spread.Keystroke(Keys.Enter, Keys.None), FarPoint.Win.Spread.SpreadActions.MoveToNextRow) |