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 ("
|
tool-tip | String | No default | Tool tip text of the button. A text starting with string " |
command | String | No default | Name of command triggered by the button. |
parameter | String | No default | Parameter of command triggered by the button. Use number 0 to specify a null parameter. |
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). |
menu-at-left | Boolean: yes|no, 1|0, true|false, on|off | no | Value Value |
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.
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 | EMPTY_STRING ',' EMPTY_STRING ',' EMPTY_STRING
Number 0
specifies a null parameter.
"","",""
is a separator.
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"))