Spread Windows Forms 18
Spread Windows Forms 18 Product Documentation / Developer's Guide / Keyboard Interaction / Customizing the Input Maps
In This Topic
    Customizing the Input Maps
    In This Topic

    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.

    Using Code

    1. Create a new InputMap object for which to map keys and actions.
    2. Set an existing input map equal to the InputMap object you created.
    3. Use the InputMap class Put method to map specific keys to specific actions.

    Example

    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)
    

    Using the Spread Designer

    1. In the Settings menu, click the Input Map icon under the Other Settings section.
    2. Select the input map, key, and action.
    3. Add the new key and action.
    4. Select OK.
    5. From the File menu choose Apply and Exit to apply your changes to the component and exit Spread Designer.
    See Also