joliclic

home

kh-xscale

« Index [ Examples | Attributes | Properties | Methods ]

An extended kh-scale, twinned by a xul:textbox of type "number".
Any change of the value of the kh-scale is passed to the textbox, and vice versa.

Any attributes of a xul:scale are inherited.

Scroll events are handled by the kh-scale and the textbox.

An event of type "khchange" is dispatched when the value of the element change. If this value have been setted with the setValue method, and true as its "silent" parameter, event.detail will contains the value of the KH_FLAG_SILENT property (0).

Attributes
scalewidth, scaleheight, colors
Properties
value, colors, scale, textbox, KH_FLAG_SILENT
Methods
setValue, getColors, setColors

Examples

example screenshot
<kh-xscale scalewidth="120" scaleheight="24"
           colors="#f0f;#ff0"/>
example screenshot
<kh-xscale orient="vertical"
           scalewidth="30" scaleheight="140"
           colors="green;#ff0;#0ff;red"/>

live examples:


Attributes

scalewidth

type: integer

The width of the kh-scale. Default = 100;

scaleheight

type: integer

The height of the kh-scale. Default = 20.

colors

type: string

The initial colors of the background. List of valid SVG colors, separated by the character ";". Any valid SVG color can be used (#rgb, #rrggbb, rgb(r, g, b), SVG name). A linear gradient will be applied between each colors. Default = "#fff;#fff".


To change later these colors, use the colors property, or the setColors() method.

Properties

value

type: integer

Get and set the value of the element, i.e. the value of the kh-scale and of the textbox

colors

type: string

Get and set the colors of the background of the scale. List of valid SVG colors separated by the character ";". A linear gradient will be applied between each colors.

scale

readonly

type: element

The kh-scale element.

textbox

readonly

type: element

The textbox element.

KH_FLAG_SILENT

readonly

type: integer

This flag is used when the setValue() have been called. If true is passed as the silent parameter, the khchange event will be fired with this value as event.detail.

Methods

void setValue(integer val, optional boolean silent)

Set the value property of the element.
If silent parameter is passed as true, the khchange event will be dispatched with the value of the KH_FLAG_SILENT property for the event.detail.

string getColors()

Get the colors of the background, a list of SVG colors separated by the ";" character.

void setColors(string colors)

Set the colors of the background. You must pass a list of SVG colors separated by the ";" character. A gradient will be applied between each colors.

Khromaxul - version: 0.3alpha - 2009-07-30