admin';?>

首页 / xul

设置快捷键

By admin •  2018-02-23 23:07:32 •  59次点击
https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XUL/Tutorial/Keyboard_Shortcuts

<xul:keyset>
<xul:key  modifiers="alt" keycode="VK_F2" oncommand="alert('你按了快捷键alt + F2');" />
<xul:key id="key2" modifiers="control alt" key="C" oncommand="alert('你按了快捷键crtl+alt+C')"/>
<xul:key keycode="VK_F5" oncommand="location.reload();" />
</xul:keyset>

The keycode attribute should be set to a special code which represents the key you want. A table of the keys is listed below. Not all of the keys are available on all keyboards.

VK_CANCEL VK_BACK VK_TAB VK_CLEAR
VK_RETURN VK_ENTER VK_SHIFT VK_CONTROL
VK_ALT VK_PAUSE VK_CAPS_LOCK VK_ESCAPE
VK_SPACE VK_PAGE_UP VK_PAGE_DOWN VK_END
VK_HOME VK_LEFT VK_UP VK_RIGHT
VK_DOWN VK_PRINTSCREEN VK_INSERT VK_DELETE
VK_0 VK_1 VK_2 VK_3
VK_4 VK_5 VK_6 VK_7
VK_8 VK_9 VK_SEMICOLON VK_EQUALS
VK_A VK_B VK_C VK_D
VK_E VK_F VK_G VK_H
VK_I VK_J VK_K VK_L
VK_M VK_N VK_O VK_P
VK_Q VK_R VK_S VK_T
VK_U VK_V VK_W VK_X
VK_Y VK_Z VK_NUMPAD0 VK_NUMPAD1
VK_NUMPAD2 VK_NUMPAD3 VK_NUMPAD4 VK_NUMPAD5
VK_NUMPAD6 VK_NUMPAD7 VK_NUMPAD8 VK_NUMPAD9
VK_MULTIPLY VK_ADD VK_SEPARATOR VK_SUBTRACT
VK_DECIMAL VK_DIVIDE VK_F1 VK_F2
VK_F3 VK_F4 VK_F5 VK_F6
VK_F7 VK_F8 VK_F9 VK_F10
VK_F11 VK_F12 VK_F13 VK_F14
VK_F15 VK_F16 VK_F17 VK_F18
VK_F19 VK_F20 VK_F21 VK_F22
VK_F23 VK_F24 VK_NUM_LOCK VK_SCROLL_LOCK
VK_COMMA VK_PERIOD VK_SLASH VK_BACK_QUOTE
VK_OPEN_BRACKET VK_BACK_SLASH VK_CLOSE_BRACKET VK_QUOTE
VK_HELP

<?xml version="1.0" encoding="utf-8"?>
<window xmlns="http://www.mozilla.org/keymaster/gat...re.is.only.xul">
 <keyset>
   <key id="cut_cmd" modifiers="accel" key="X"/>
   <key id="copy_cmd" modifiers="accel" key="C"/>
   <key id="paste_cmd" modifiers="accel" key="V"/>
   <key id="close_cmd" keycode="VK_ESCAPE" oncommand="window.close();"/>
 </keyset>

 <vbox flex="1">
  <toolbox>
   <menubar id="findfiles-menubar">
    <menu id="file-menu" label="File" accesskey="f">
     <menupopup id="file-popup">
      <menuitem label="Open Search..." accesskey="o"/>
      <menuitem label="Save Search..." accesskey="s"/>
      <menuseparator/>
      <menuitem label="Close" accesskey="c" key="close_cmd" 
       oncommand="window.close();"/>
     </menupopup>
    </menu>
    <menu id="edit-menu" label="Edit" accesskey="e">
     <menupopup id="edit-popup">
      <menuitem label="Cut" accesskey="t" key="cut_cmd"/>
      <menuitem label="Copy" accesskey="c" key="copy_cmd"/>
      <menuitem label="Paste" accesskey="p" key="paste_cmd" disabled="true"/>
     </menupopup>
    </menu>
   </menubar>
  </toolbox>
 </vbox>
</window>

0 回复 | 直到2019-03-26 07:59添加回复

回复

登录发表 or 还没有账号?去注册

他山跨平台混合应用开发框架

现在注册 已注册请 登入

节点列表

Demo发布

Windows  Linux  Android  最新进展 

经验交流

功能建议  Windows  Linux  Android  开发交流  资源分享  js  xul 

BUG反馈

Windows  Linux  Android 

学习生活

灌水乐园  大话界面