Overview[]
Slider is a library designed to help widget designers to easily create sliders for their GUI or custom preferences panels. The slider behave almost like Konfabulator's native objects and its properties can be changes on-the-fly. It also have skinning capabilities (3 skins are currently included).
To use it, simply include the slider.js file and create a slider.
Here is a screenshot using the « Aqua Small » theme:
http://www.dr-gang.com/widget/Small.png
Download the test widget: slider.widget
Properties[]
Property | Description | Default value |
---|---|---|
hOffset | horizontal offset | 0 |
vOffset | vertical offset | 0 |
width | total width (without text area) | 100 |
step | incremental value | 1 |
stick | if true, the slider sticks to the step values. if false, it slides smoothly | false |
showValue | if true, the current value is shown in the text area instead of the percentage | false |
unit | unit to display in the text area when showValue is true | "" |
min | min value | 0 |
max | max value | 100 |
value | current value (used to init the slider) To get the current value, using onMouseMove/onMouseUp is more elegant. | 50 |
theme | theme used by all the sliders | "AquaLarge" |
onMouseDown | function called when the slider is clicked. The current value is passed as first argument. | null |
onMouseMove | function called when the slider is moved. The current value is passed as first argument. | null |
onMouseUp | function called when the slider is released. The current value is passed as first argument. | null |
Example[]
Here is the code for the second slider of the screenshot :
var s2 = new slider(mainWindow); s2.width = 100; s2.hOffset = 20; s2.vOffset =52; s2.min = 800; s2.max = 2000; s2.value = 1600; s2.showValue = 1; s2.step = 200; s2.unit = "円"; s2.theme = "AquaSmall";