6. command-button
Prev | Chapter 5. Content objects | Next

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

Key | Value | Default | Description
--- | --- | --- | ---
icon | url(), disc, circle, square, icon() | No default | Icon of the button. A button can have both a label and an icon.
text | String | No default | Label of the button. May contain newlines ("`\A` " in CSS). `Element-*()` pseudo functions are allowed here (see element-name).
tool-tip | String | No 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`".
command | String | No default | Name of command triggered by the button.
parameter | String | No default | Parameter of command triggered by the button.
menu | A menu of commands. See syntax below | No default | Menu of commands triggered by the button. A button can have both a command (Click-1) and a menu (Click-3).
icon-gap | Length (5px, 3em, etc) | 4px | Distance between icon and label.
icon-position | right | top | bottom | left | left | Position of icon relative to the label.
select | none | element | element | By 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

- `0` specifies a null parameter.

- `"","",""` is a separator.

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

Prev | Up | Next
5. combo-box | Home | 7. component