Page tree
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

你可以改变快捷键的设置。

快捷键的行为包括:单元格导航、选择、剪切、复制、粘贴、清除、撤销和重做。


示例代码

以下代码更改了“左移”操作的快捷键。

JavaScript

Copy Code

//使用 Control+Shift+b

spread.commandManager().setShortcutKey("navigationLeft","B".charCodeAt(0),true,true,false,false);

 

示例代码

以下代码更改了键盘上的上下方向键的默认行为。

JavaScript

Copy Code

var activeSheet = spread.getActiveSheet();//将上方向键的操作改变为“向上翻页”

spread.commandManager().setShortcutKey("navigationPageUp", GC.Spread.Commands.Key.up, false, false, false, false);

//将下方向键的操作改为“向下翻页”

spread.commandManager().setShortcutKey("navigationPageDown", GC.Spread.Commands.Key.down, false, false, false, false);

 

示例代码
以下代码创建了一个自定义快捷键:

JavaScript

Copy Code

var activeSheet = spread.getActiveSheet(); spread.commandManager().register('myCmd',       function ColorAction() {                                //Click on a cell and press the Enter key.            activeSheet.getCell(activeSheet.getActiveRowIndex(), activeSheet.getActiveColumnIndex()).backColor("red");                }            );
       //Map the created action to the Enter key.       spread.commandManager().setShortcutKey('myCmd', GC.Spread.Commands.Key.enter, false, false, false, false);

 

另见:
Key Enumeration
setShortcutKey Method

  • No labels