Visit Mozilla.org

XUL:scale

From MDC

This article covers features introduced in Firefox 3

« XUL Reference home    [ Examples | Attributes | Properties | Methods | Related ]

A scale (sometimes referred to as a "slider") allows the user to select a value from a range. A bar displayed either horizontally or vertically allows the user to select a value by dragging a thumb on the bar.

Use the orient attribute to specify the orientation of the scale. The default value is horizontal which displays a horizontal scale. Lower values are to the left and higher values are to the right. Set the orient attribute to vertical to use a vertical scale.

The user may use the arrow keys to increment and decrement the value by one unit, or the page up and page down keys to increment and decrement the value by one page, as specified by the pageincrement attribute. The home and end keys set the scale's value to the minimum and maximum values, respectively. A scale will fire a change event whenever the scale's value is modified.

Attributes
dir, disabled, increment, max, min, pageincrement, tabindex, value
Properties
disabled, max, min, increment, pageIncrement, tabIndex, value,
Methods
decrease, decreasePage, increase, increasePage,

[edit] Examples

Horizontal Scale:

<scale min="1" max="10"/>

Image:Controlguide-scale.png

Vertical Scale:

<scale min="1" max="10" orient="vertical"/>

[edit] 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

dir
Type: one of the values below
The direction in which the child elements of the element are placed.
  • normal: The scale's values are ordered from left to right (for horizontal scales) or from top to bottom (for vertical scales)
  • reverse: The scale's values are ordered from right to left (for horizontal scales) or from bottom to top (for vertical scales).

disabled
Type: boolean
Indicates whether the element is disabled or not. If this element is set to true the element is disabled. Disabled elements are usually drawn with grayed-out text. If the element is disabled, it does not respond to user actions, it cannot be focused, and the command event will not fire.

increment
Type: integer
The amount by which the curpos (for scroll bars) or value (for number boxes) attribute changes by when the arrows are clicked. The default value is 1.

min
Type: integer
The minimum value that the scale may be set to. The default value is 0.

max
Type: integer
The maximum value that the scale may be set to. The default value is 100.

pageincrement
Type: integer
The amount by which the value of the value attribute changes by when the PgUp or PdDn keys are pressed. The default value is 10.

tabindex
Type: integer
The tab order of the element. The tab order is the order in which the focus is moved when the user presses the "tab" key. Elements with a higher tabindex are later in the tab sequence.

value
Type: string
The string attribute allows you to associate a data value with an element. It is not used for any specific purpose, but you can access it with a script for your own use.

[edit] Properties

Inherited from XUL element
align, allowEvents, boxObject, builder, className, collapsed, contextMenu, controllers, currentItem, database, datasources, dir, flex, height, hidden, id, left, listBoxObject, maxHeight, maxWidth, menu, minHeight, minWidth, observes, ordinal, orient, pack, persist, ref, resource, statusText, style, tooltip, tooltipText, top, value, width

Inherited from DOM element
attributes, childNodes, cloneNode, firstChild, lastChild, localName, namespaceURI, nextSibling, nodeName, nodeType, nodeValue, ownerDocument, parentNode, prefix, previousSibling, tagName

disabled
Type: boolean
Gets and sets the value of the disabled attribute.

increment
Type: integer
Gets and sets the value of the increment attribute.

min
Type: integer
Gets and sets the value of the min attribute.

max
Type: integer
Gets and sets the value of the max attribute.

pageIncrement
Type: integer
Gets and sets the value of the pageincrement attribute.

tabIndex
Type: integer
Gets and sets the value of the tabindex attribute.

value
Type: string
Gets and sets the value of the value attribute.

[edit] Methods

Inherited from XUL element
blur, click, doCommand, focus, getElementsByAttribute

Inherited from DOM element
addEventListener, appendChild, dispatchEvent, getAttribute, getAttributeNode, getAttributeNodeNS, getAttributeNS, getElementsByTagName, getElementsByTagNameNS, hasAttribute, hasAttributeNS, hasAttributes, hasChildNodes, insertBefore, isSupported, normalize, removeAttribute, removeAttributeNode, removeAttributeNS, removeChild, removeEventListener, replaceChild, setAttribute, setAttributeNode, setAttributeNodeNS, setAttributeNS

decrease()
Return type: no return value
Decreases the value of the scale by the increment.

decreasePage()
Return type: no return value
Decreases the value of the scale by the pageincrement.


increase()
Return type: no return value
Increases the value of the scale by the increment.

increasePage()
Return type: no return value
Increases the value of the scale by the page increment.

[edit] Related

Interfaces
nsIDOMXULControlElement