|Visual Basic (Declaration)
Public Class InputMap
|Visual Basic (Usage)
Dim instance As InputMap
public class InputMap
Input maps describe the way keyboard actions are interpreted by the Spread component. A map consists of a set of definitions where each definition is pair of a key or key combination and the specific action associated with it. An example is the default definition that pressing the Home key moves the active cell to the first cell in the row.
Input maps work based on two factors:
- the input map mode, which defines what will receive the key or key combination
- the operation mode of the sheet
For more information, refer to Managing Keyboard Interaction.
Input Map Mode
The first factor is what receives the keystroke or keystroke combination. Keystroke processing in .NET is handled in two phases: a pre-processing phase and a normal-processing phase. Most keystroke processing in Spread is handled during the pre-processing phase, which corresponds to the WhenAncestorOfFocused input map mode. (Refer to InputMapMode enumeration settings.) In the pre-processing phase, keystrokes are handled by the IsInputChar, IsInputKey, ProcessDialogChar, and ProcessDialogKey methods.
The normal-processing phase corresponds to the WhenFocused input map mode. In the normal-processing phase, keystrokes are handled by the OnKeyDown, OnKeyPress, and OnKeyUp methods (which raise the KeyDown, KeyPress, and KeyUp events respectively).
For a typical Spread component, most interactions that occur while you are working with the component occur as part of the WhenAncestorOfFocused input map. Actions such as moving the active cell, selecting a range of cells, and others would be part of this map. For example, pressing the Tab key moves the active cell, even if a cell is in edit mode. In contrast, some keys are only mapped when there is not a cell in edit mode (the component has the focus, but not a cell editor). For example, the equals (=) key does not perform an action if pressed when a cell is in edit mode. If no cell is in edit mode, pressing the equals key starts formula editing for the active cell.
If you want to work with keystrokes, remember this distinction between pre-processing (WhenAncestorOfFocused) and normal-processing (WhenFocused) of keystrokes.
The second factor that affects input maps is the operation mode of the sheet. Different keys will have different maps by default depending on the operation mode. For example, if the operation mode is read only, there are no keys mapped by default to move the active cell, because there is no active cell.
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2