1. binding
Prev | Chapter 7. Configuration elements | Next

## 1. binding

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

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

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

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

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

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

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

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

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

    <charTyped
      char = single character
    />

    <appEvent
      name = name of application event
    />

    <command
      name = NMTOKEN
      parameter = string
    />

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

    <separator
    />

    <item
      label = non empty token
      icon = anyURI
      command = NMTOKEN
      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 | BRACELEFT | BRACERIGHT | C |
                CANCEL | CAPS_LOCK | CIRCUMFLEX | CLEAR |
                CLOSE_BRACKET | CODE_INPUT | COLON | COMMA |
                COMPOSE | 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 | 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:

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

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

      <binding>
        <mousePressed button="2" />
        <menu label="XHTML">
          <menu label="Table">
            <item label="Insert column before" command="xhtml.tableColumn"
                  parameter="insertBefore"/>
            <item label="Insert column after" command="xhtml.tableColumn"
                  parameter="insertAfter"/>
            <item label="Delete column" command="xhtml.tableColumn"
                  parameter="delete"/>
          </menu>
          <separator />
          <item label="Go to opposite link end"
                command="xhtml.crossReference" parameter="swap" />
          <separator />
          <item label="Preview" icon="icons/preview.gif"
                command="xhtml.preview" />
        </menu>
      </binding>

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

Prev | Up | Next
Chapter 7. Configuration elements | Home | 2. command