Mozilla XUL Element and Script Reference

Contents  Quick Reference

Toolbarbutton

    Moz0.9.5

A button that appears on a toolbar. It is equivalent to a regular button except that it may be rendered differently.

Attributes:

Attributes inherited from XUL Element

accesskey

This should be set to a letter that is used as a shortcut key. This letter should be one of the characters that appears in the label text for the toolbarbutton. This letter will typically be drawn underlined, although this behavior will be platform and skin specific. When the user presses ALT (or a similar key that varies on each platform) and the access key, the toolbarbutton will be activated from anywhere in the window.

command

Set to an id of a command element that is being observed by the element.

crop

If the label of the toolbarbutton is too small to fit in its given space, the text will be cropped on the side specified by the crop attribute. An ellipsis will be placed in place of the cropped text. If the box direction is right to left (rtl), the cropping is reversed.

dir

The direction in which the child elements of the toolbarbutton are placed.

disabled

If this attribute is set to true, the toolbarbutton is disabled. This is usually drawn with the text in grey. If the toolbarbutton is disabled, the function of the button cannot be performed. Leave the attribute out entirely for a regular enabled button.

image

The URL of the image to appear on the toolbarbutton. If this is attribute is left out, no image appears. The position of the image is determined by the dir and orient attributes.

label

The label that will appear on the toolbarbutton. If this is left out, no text appears.

orient

Used to specify whether the children of the toolbarbutton are oriented horizontally or vertically. The default value depends on the element. You can also use the '-moz-box-orient' style property.

tabindex

type

The type of button. If this attribute is not present, a normal button is created. You can set the type attribute to the value 'menu' to create a button with a menu popup. This will typically cause the button to be displayed differently.

validate    Moz0.9.6

This attribute indicates whether to load the image from the cache or not. This would be useful if the images are stored remotely or you plan on swapping the image frequently. The following values are accepted:

value

A value associated with the toolbarbutton. You may use it in a script for your own purposes.

Properties and Methods:

Properties and Methods inherited from XUL Element

accesskey

This should be set to a letter that is used as a shortcut key. This letter should be one of the characters that appears in the label text for the toolbarbutton. This letter will typically be drawn underlined, although this behavior will be platform and skin specific. When the user presses ALT (or a similar key that varies on each platform) and the access key, the toolbarbutton will be activated from anywhere in the window.

blur ( )

If the focus is on the element, it is removed. The focus is not automatically placed on any other element. Essentially, this is used to call the onblur handler.

command

Set to an id of a command element that is being observed by the element.

controllers

crop

If the label of the toolbarbutton is too small to fit in its given space, the text will be cropped on the side specified by the crop attribute. An ellipsis will be placed in place of the cropped text. If the box direction is right to left (rtl), the cropping is reversed.

dir

Gets and sets the value of the dir attribute.

doCommand ( )

Executes the associated command.

focus ( )

Assigns the focus to the element, if it can accept the focus. The onfocus handler is called.

image

The URL of the image to appear on the toolbarbutton. If this is attribute is left out, no image appears. The position of the image is determined by the dir and orient attributes.

label

The label that will appear on the toolbarbutton. If this is left out, no text appears.

orient

Gets and sets the value of the orient attribute.

type

Gets and sets the value of the type attribute.

value

A value associated with the toolbarbutton. You may use it in a script for your own purposes.