toolbox

A container for toolbars. It is a type of box but defaults to vertical orientation. If a toolbar is placed inside a toolbox, a grippy is displayed on its left or upper edge. The user may click the grippy to collapse the toolbar. If multiple toolbars are placed in the same toolbox, they will all collapse into the same row. The Firefox browser does not have grippies so toolbars cannot be collapsed and expanded.

Note: Gecko 2.0 adds support for external toolbars. These are toolbars that are not children of a toolbox. You can associate an external toolbar with a toolbox for the purpose of managing your toolbars by setting the toolboxid property on the toolbar. The external toolbars associated with a toolbox are listed in the array of elements provided by the toolbox's externalToolbars property.

More information is available in the XUL tutorial.

If you'd like to detect when toolbars in a toolbox are changed, see Toolbar customization events.

Properties
accessible, customToolbarCount, externalToolbars, palette, toolbarset
Methods
appendCustomToolbar, collapseToolbar, expandToolbar

Examples

toolbox.png

<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<window id="yourwindow" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" title="toolbox example" width="300">
  <toolbox>
    <toolbar>
      <toolbarbutton label="Back"/>
      <toolbarbutton label="Forward"/>
      <toolbarbutton label="Home"/>
    </toolbar>
    <toolbar>
      <toolbarbutton label="Stop"/>
      <toolbarbutton label="Reload"/>
    </toolbar>
  </toolbox>
  <textbox multiline="true" value="We have two toolbars inside of one toolbox above." width="20"/>
</window>

Attributes

Inherited from XUL element
align, allowevents, allownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortDirection, sortResource, sortResource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width

Properties

accessible
Type: nsIAccessible
Returns the accessibility object for the element.
customToolbarCount
Firefox only
Type: integer
The number of custom toolbars currently within the toolbox.
externalToolbars
Type: array of elements
An array of external toolbars; that is, toolbar elements that should be considered to be members of this toolbox, even if they are not actually children of the toolbox.
palette
Firefox only
Type: element
The toolbarpalette within the toolbox.
toolbarset
Firefox only
Type: element
The toolbarset within the toolbox.

Methods

Inherited Methods
addEventListener(), appendChild(), blur, click, cloneNode(), compareDocumentPosition, dispatchEvent(), doCommand, focus, getAttribute(), getAttributeNode(), getAttributeNodeNS(), getAttributeNS(), getBoundingClientRect(), getClientRects(), getElementsByAttribute, getElementsByAttributeNS, getElementsByClassName(), getElementsByTagName(), getElementsByTagNameNS(), getFeature(), getUserData, hasAttribute(), hasAttributeNS(), hasAttributes(), hasChildNodes(), insertBefore(), isDefaultNamespace(), isEqualNode, isSameNode, isSupported(), lookupNamespaceURI, lookupPrefix, normalize(), querySelector(), querySelectorAll(), removeAttribute(), removeAttributeNode(), removeAttributeNS(), removeChild(), removeEventListener(), replaceChild(), setAttribute(), setAttributeNode(), setAttributeNodeNS(), setAttributeNS(), setUserData

appendCustomToolbar( name, currentset )
Firefox only
Return type: element
Adds a custom toolbar to the toolbox with the given <var>name</var>. You can supply a comma-separated list of toolbar item ids as the second argument to add some items by default. The method returns the DOM element for the created toolbar.
collapseToolbar( toolbar )
Not in Firefox
Return type: no return value
Collapse the given <var>toolbar</var> which should be contained within the toolbox.
expandToolbar( toolbar )
Not in Firefox
Return type: no return value
Expand the given <var>toolbar</var> which should be contained in the toolbox.

Elements
toolbar, toolbarbutton, toolbargrippy, toolbaritem, toolbarpalette, toolbarseparator, toolbarset, toolbarspacer, toolbarspring
Interfaces
nsIAccessibleProvider

Document Tags and Contributors

Contributors to this page: Sheppy, kscarfone, trevorh, Gryllida, q0k, Mgjbot, Ptak82, Dria, Pmash
Last updated by: Sheppy,