This method allows you to map a keyboard key which will cause an action.
Syntax
[JavaScript]
FpSpread1.AddKeyMap(keycode,ctrl,shift,alt,action);
Parameters
- keycode
- Integer, key being pressed
- ctrl
- Boolean, Control key
- shift
- Boolean, Shift key
- alt
- Boolean, Alt key
- action
- Constant, MoveToPrevCell, MoveToNextCell, MoveToNextRow, MoveToPrevRow, MoveToFirstColumn, MoveToLastColumn, ScrollTo
Return Type
None
Remarks
This method allows you to set a JavaScript code action based on a key the user presses. The action can move to the next or previous cell or row, first or last column, or scroll to a cell.
Example
This is a sample that contains the method. On the client side, the script that contains the method would look like this:
JavaScript | Copy Code |
---|---|
<SCRIPT language=javascript> function setMap() { var ss = document.getElementById("FpSpread1"); if (ss != null){ //IE9 or earlier //ss.AddKeyMap(13,true,true,false,"this.MoveToLastColumn()"); ss.AddKeyMap(13,true,true,false,"element.MoveToLastColumn()"); } </SCRIPT> |
The following code passes a function to the AddKeyMap method. This code works for Microsoft Internet Explorer (IE) and Mozilla Firefox.
JavaScript | Copy Code |
---|---|
window.onload = function() { var spread1 = document.getElementById("FpSpread1"); spread1.AddKeyMap(13, false, false, false, function() { var ss = spread1; ss.MoveToLastColumn(); }); } |