Monday, September 08, 2008  



 FarPoint Technologies
 (800) 645-5913

 fpsales@fpoint.com



     
 »Spread for Windows Forms » Product Tour » Keyboard Interaction » Interaction

Previous Managing Keyboard Interaction Next

  Back to Top
 Underlying Keystroke Processing
The Spread control builds its keystroke processing on top of the underlying Windows keystroke processing. In addition to the .NET Framework's methods and events that handle keyboard input, the Spread control provides input maps. Input maps provide a table-based description of the keyboard behavior for a control. This allows the application to query the keyboard behavior for a control. An input map is essentially a collection of keystrokes and related actions.

The Spread control provides a WhenFocused input map for processing keystrokes that occur while the control has focus. The WhenFocused input map is used to implement the FpSpread class's IsInputKey, IsInputChar, OnKeyDown, OnKeyPress, and OnKeyUp methods which in turn raise the KeyDown, KeyPress, and KeyUp events.

The Spread control provides a WhenAncestorOfFocused input map for processing keystrokes that occur while the control or one of its child controls has focus. The WhenAncestorOfFocused input map is used to implement the FpSpread class's ProcessDialogKey and ProcessDialogChar methods.

The Spread control has multiple operation modes (Normal, ReadOnly, RowMode, SingleSelect, MultiSelect, ExtendedSelect). Each operation mode requires different keyboard behavior. Therefore, the Spread control has separate WhenFocused and WhenAncestorOfFocused input maps for each operation mode.


Back to Top
 Underlying Keystroke Processing
Keyboard navigation is defined by default maps, that map user keyboard actions with Spread control actions. For example, by default, pressing Tab moves the active cell to the next column. You can customize any or all of the keyboard actions by mapping them to Spread control actions as you want.

The default behavior for keyboard usage is summarized in this table:

Key Code Action
Enter Begins editing; stops editing if edit mode is on.
Escape If edit mode is on, previous cell value replaces new value and edit mode is turned off
Tab Moves the active cell to the next column and wraps at the end of the row
Shift + Tab Moves the active cell to the previous column and wraps at the end of the row
F2 If edit mode is on, clears the active cell's value
F3 If edit mode is on, places the current date and time in a date-time cell
F4 If edit mode is on in a date cell, spreadsheet displays a pop-up calendar to let you choose a date
= Begins editing formula
Ctrl+C or Ctrl+Insert Copies the selection to the Clipboard
Ctrl+X or Shift+Delete Cuts the selection to the Clipboard
Ctrl+V or Shift+Insert Pastes the data and formatting from the Clipboard
Up arrow Moves active cell up one row
Down arrow Moves active cell down one row
Left arrow Moves active cell left one column
Right arrow Moves active cell right one column
Shift + Up arrow Extends selection up one row
Shift + Down arrow Extends selection down one row
Shift + Left arrow Extends selection left one column
Shift + Right arrow Extends selection right one column
Control + Up arrow Moves active cell up one row
Control + Down arrow Moves active cell down one row
Control + Left arrow Moves active cell left one column
Control + Right arrow Moves active cell right one column
Shift + Control + Up arrow Extends selection up one row
Shift + Control + Down arrow Extends selection down one row
Shift + Control + Left arrow Extends selection left one column
Shift + Control + Right arrow Extends selection right one column
Page Up Moves active cell up one page of rows
Page Down Moves active cell down one page of rows
Shift + Page Up Extends selection up one page of rows
Shift + Page Down Extends selection down one page of rows
Control + Page Up For a single sheet, moves active cell left one page of columns; for multiple sheets, moves the active sheet one sheet to the left
Control + Page Down For a single sheet, moves active cell right one page of columns; for multiple sheets, moves the active sheet one sheet to the right
Shift + Control + Page Up Extends selection left one page of columns
Shift + Control + Page Down Extends selection right one page of columns
Home Moves active cell to the first cell in the row
End Moves active cell to the last cell in the row
Shift + Home Extends the selection to include the first column
Shift + End Extends the selection to include the last column
Control + Home Moves active cell to first row, first column
Control + End Moves active cell to last row, last column
Shift + Control + Home Extends the selection to include the first cell
Shift + Control + End Extends the selection to include the last cell
Shift + space Selects the current row
Control + space Selects the current column
Shift + Control + space Selects the current sheet


Back to Top
 Default Maps
Spread provides twelve default maps that map keystrokes to actions for each focus location (referred to as input map mode) and operation mode, You can customize any or all of these maps to change the action associated with a keystroke or to add additional actions for other keystrokes.

Back to Top
 Input Map Plus Action Map
Internally, the SpreadView uses an input map paired with an action map to process a keystroke. An input map (InputMap object) is used to convert a key stroke (KeyStroke object) to an object that identifies the action). An action map (ActionMap object) is used to convert the object to an action.

For example,Excel uses Ctl+9 and Ctl+Shift+9 to hide and unhide rows. Suppose you wanted to implement this feature in Spread. You could easily create the classes to define the hide and unhide actions.


Back to Top
 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 control action. For example, you can set the Enter key to always move to the next cell.

Previous Managing Keyboard Interaction Next

    
 Have a question?
Have a Question? Ask Us!
Subscribe to the RSS feed!RSS Subscribe
 

 
Learn about the new Roadshow now!

Tour Home
Overview
Appearance
User Interaction
Cell Types
Formulas
Managing Data
Data Binding
Import/Export
Printing
Keyboard Interaction
Shapes
Models
Spread Designer
 
Map

Copyright © 1991-2007 FarPoint Technologies, Inc. All rights reserved. All names are property of their respective owners.