6. command-button

command-button(key, value, ..., key, value)

Inserts a button in generated content which can be used to execute a command (see Chapter 6, Commands written in the Java™ programming language in XMLmind XML Editor - Commands) and/or to popup a menu of commands.

KeyValueDefaultDescription
iconurl(), disc, circle, square, icon()No defaultIcon of the button. A button can have both a label and an icon.
textStringNo default

Label of the button. Can contain newlines ("\A " in CSS).

Element-*() pseudo functions are allowed here (see element-name).

commandStringNo defaultName of command triggered by the button.
parameterStringNo defaultParameter of command triggered by the button.
menuA menu of commands. See syntax belowNo defaultMenu of commands triggered by the button. A button can have both a command (Click-1) and a menu (Click-3).
icon-gapLength (5px, 3em, etc)4pxDistance between icon and label.
icon-positionright | top | bottom | leftleftPosition of icon relative to the label.
selectnone | elementelementBy default, clicking a button selects the element having the generated content before attempting to execute the command. "select, none" disables this behavior.

Key, value, ..., key, value may also specify style parameters.

Menu syntax:

menu -> 'menu(' item+ ')'

item->   label ',' command ',' parameter|'0'
       | label ',' 'menu' ',' menu
       | EMPTY_STRING ',' EMPTY_STRING ',' EMPTY_STRING

Examples:

command-button(text, "Say hello",
               command, "alert",
               parameter, "Hello!",
               select, none,
               font-style, italic)

command-button(icon, icon(pop-right), 
               menu, menu("Insert tr Before", 
                          "insertNode", "sameElementBefore",
                          "Insert tr After", 
                          "insertNode", "sameElementAfter",
                          "", "", "",
                          "Delete tr", "delete", 0,
                          "", "", "",
                          "Clipboard", menu, menu(
                              "Copy tr", "copy", 0,
                              "Cut tr", "cut", 0,
                              "Paste Before tr", "paste", "before",
                               "Paste After tr", "paste", "after")))

command-button(text, "+", 
               icon, disc,
               icon-position, right,
               icon-gap, 0,
               command, "insertNode", 
               parameter, "sameElementAfter",
               menu, menu("Copy li", "copy", 0,
                          "Cut li", "cut", 0,
                          "Paste Before li", "paste", "before",
                          "Paste After li", "paste", "after"))