Contents
Index
Search

3. binding

<binding>
  Content: [ mousePressed | mouseDragged | mouseReleased | 
             mouseClicked | mouseClicked2 | mouseClicked3 |
             [ keyPressed | charTyped ]{1,3} |
             appEvent ]
           [ command | menu ]?
</binding>

<mousePressed
  button = (1|2|3|popupTrigger1) : 1
  modifiers = possibly empty list of (ctrl|shift|alt|meta|altGr|mod2)
/>

<mouseDragged
  button = (1|2|3|popupTrigger) : 1
  modifiers = possibly empty list of (ctrl|shift|alt|meta|altGr|mod)
/>

<mouseReleased
  button = (1|2|3|popupTrigger) : 1
  modifiers = possibly empty list of (ctrl|shift|alt|meta|altGr|mod)
/>

<mouseClicked
  button = (1|2|3|popupTrigger) : 1
  modifiers = possibly empty list of (ctrl|shift|alt|meta|altGr|mod)
/>

<mouseClicked23
  button = (1|2|3|popupTrigger) : 1
  modifiers = possibly empty list of (ctrl|shift|alt|meta|altGr|mod)
/>

<mouseClicked34
  button = (1|2|3|popupTrigger) : 1
  modifiers = possibly empty list of (ctrl|shift|alt|meta|altGr|mod)
/>

Note that:

1

popupTrigger is a shorthand for mouse-pressed-3, no matter the modifiers or the number of clicks. On the Mac, it is additionally a shorthand for Ctrl+mouse-pressed-1.

2

mod is the Command key on Mac and the Control key on other platforms.

3 4

mouseClicked2 is a double click. mouseClicked3 is a triple click.

<keyPressed
  code = key code
  modifiers = possibly empty list of (ctrl|shift|alt|meta|altGr|mod)
/>

<charTyped
  char = single character
/>

<appEvent
  name = name of application event
/>

<command
  name = NMTOKEN (optionally preceded by a command namespace)
  parameter = string
/>

<menu
  label = non empty token
>
  Content: [ menu | separator | item ]+
</menu>

<separator
/>

<item
  label = non empty token
  icon = anyURI
  command = NMTOKEN (optionally preceded by a command namespace)
  parameter = string
/>

key code = (0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 
            9 | A | ACCEPT | ADD | AGAIN | 
            ALL_CANDIDATES | ALPHANUMERIC | AMPERSAND | 
            ASTERISK | AT | B | BACK_QUOTE | BACK_SLASH | 
            BACK_SPACE | BEGIN | BRACELEFT | BRACERIGHT | C | 
            CANCEL | CAPS_LOCK | CIRCUMFLEX | CLEAR | 
            CLOSE_BRACKET | CODE_INPUT | COLON | COMMA | COMPOSE |
            CONTEXT_MENU | CONVERT | COPY | CUT | D | DEAD_ABOVEDOT | 
            DEAD_ABOVERING | DEAD_ACUTE | DEAD_BREVE | 
            DEAD_CARON | DEAD_CEDILLA | DEAD_CIRCUMFLEX | 
            DEAD_DIAERESIS | DEAD_DOUBLEACUTE | DEAD_GRAVE | 
            DEAD_IOTA | DEAD_MACRON | DEAD_OGONEK | 
            DEAD_SEMIVOICED_SOUND | DEAD_TILDE | 
            DEAD_VOICED_SOUND | DECIMAL | DELETE | 
            DIVIDE | DOLLAR | DOWN | E | END | ENTER | 
            EQUALS | ESCAPE | EURO_SIGN | EXCLAMATION_MARK | 
            F | F1 | F10 | F11 | F12 | F13 | F14 | F15 | F16 | F17 | 
            F18 | F19 | F2 | F20 | F21 | F22 | F23 | F24 | F3 | F4 | 
            F5 | F6 | F7 | F8 | F9 | FINAL | FIND | FULL_WIDTH | 
            G | GREATER | H | HALF_WIDTH | HELP | HIRAGANA | 
            HOME | I | INPUT_METHOD_ON_OFF | INSERT | 
            INVERTED_EXCLAMATION_MARK | J | JAPANESE_HIRAGANA | 
            JAPANESE_KATAKANA | JAPANESE_ROMAN | K | KANA | 
            KANA_LOCK | KANJI | KATAKANA | KP_DOWN | KP_LEFT | 
            KP_RIGHT | KP_UP | L | LEFT | LEFT_PARENTHESIS | 
            LESS | M | MINUS | MODECHANGE | MULTIPLY | N | 
            NONCONVERT | NUMBER_SIGN | NUMPAD0 | NUMPAD1 | 
            NUMPAD2 | NUMPAD3 | NUMPAD4 | NUMPAD5 | NUMPAD6 | 
            NUMPAD7 | NUMPAD8 | NUMPAD9 | NUM_LOCK | O | 
            OPEN_BRACKET | P | PAGE_DOWN | PAGE_UP | PASTE | 
            PAUSE | PERIOD | PLUS | PREVIOUS_CANDIDATE | 
            PRINTSCREEN | PROPS | Q | QUOTE | QUOTEDBL | R | 
            RIGHT | RIGHT_PARENTHESIS | ROMAN_CHARACTERS | 
            S | SCROLL_LOCK | SEMICOLON | SEPARATOR | SLASH | 
            SPACE | STOP | SUBTRACT | T | TAB | U | UNDERSCORE | 
            UNDO | UP | V | W | WINDOWS | X | Y | Z)

Bind a key stroke to a command or bind a mouse click to a command or a popup menu or bind an application event to a command.

Note that a key stroke or an application event cannot be used to display a popup menu.

A binding element not containing a command or menu child element may be used to remove the corresponding keyboard shortcut or mouse click.

XXE does not allow to replace any of its default bindings, just to add more bindings, unless these bindings are specified in a special purpose configuration file called customize.xxe. For more information about customize.xxe, see Generic bindings.

Examples: bind F4 to command "insert into tt":

<binding>
  <keyPressed code="F4" />
  <command name="insert" parameter="into tt" />
</binding>

Bind Esc @ to command "insert into a":

<binding>
  <keyPressed code="ESCAPE" />
  <charTyped char="@" />
  <command name="insert" parameter="into a" />
</binding>

Unbind the command bound to Ctrl+A (Command+A on the Mac):

<binding>
  <keyPressed code="A" modifiers="mod" />
</binding>

Bind Ctrl+Shift+mouse-pressed-3 to a “convert case” popup menu:

<binding>
  <mousePressed button="3" modifiers="shift ctrl" />
  <menu>
    <item label="Lower-case" command="convertCase" parameter="lower"/>
    <item label="Upper-case" command="convertCase" parameter="upper"/>
    <item label="Capital-case" command="convertCase" parameter="capital"/>
  </menu>
</binding>