7. 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.

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. May contain newlines ("\A " in CSS).

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

tool-tipStringNo default

Tool tip text of the button.

A text starting with string "<html>" is understood to be styled using HTML (not XHTML). Example: "<html>Change the <br><b>linkend</b> <br>attribute".

commandStringNo defaultName of command triggered by the button.
parameterStringNo default

Parameter of command triggered by the button.

Use number 0 to specify a null parameter.

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).
menu-at-leftBoolean: yes|no, 1|0, true|false, on|offno

Value yes indicates that the popup menu is to be displayed at the left of the point clicked upon.

Value no indicates that the popup menu is to be displayed at the right of the point clicked upon.

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.

Simple example:

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

Menu syntax:

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

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

Menu examples:

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"))