Class: Slider

LuxModule: gui

The slider is a handle than can be moved within some limits.

You can create and use a slider in this way:

 slider = Slider:new(100,20,100,20)
 function slider:onValueChanged (newvalue,oldvalue)
   print(newvalue,oldvalue)
 end
 Container.getRootContainer():add(slider)
The following skinssurface names are used by the slider class:
  1. Vertical slider skin surfaces
  2. Horizontal slider skin surfaces

Hierarchy

o-+ Component
  o-+ Slider

Methods:

Method overview:


new (class, int x,y,w,h, [boolean vertical, [Skin2D, [Icon] ] ])
returns: (Slider)
Creates Slider with given bounds. If vertical is true the slider is vertical aligned.
getSliderPos (Slider)
returns: (float pos)
get the position of the slider 0-1.
mouseWheeled (Slider,MouseEvent)
returns: ()
This function sets the sliderposition if the mousewheel was turned.
onKeyTyped (Slider,KeyEvent)
returns: ()
Attached to Slider with a keylistener. Will react on arrow up/down/left/right keypresses and moves the slider.
onValueChanged (Slider, float newvalue,prevvalue)
returns: ()
called if the slider position was changed. The values are always between 0 and 1. You can overload this function without calling the original overloaded function. This function is only called if the previous value is distinct from the new value.
setIncrement

(),(Slider, float inc) - Sets sliderincrement of slider. You could set the value directly by assigning a new value to the sliderincrement value, but you shouldn't chose values <=0 or >1 and you should update the sliderposition to its new value in case that the integermode is on and the value is hereby changed.

setIntegerMode
(),(Slider, boolean on) - switches IntegerMode on and of. In integermode, the values that are set are being rounded to even multiplies of the sliderincrement value.
setSliderPos (Slider, pos, noevent,force)
returns: ()
set the position of the slider, calls automaticly the onValueChanged method. The value is automaticly clamped to a value between 0 and 1. If noevent is true, no valuechanged event is sent
setSliderTo (Slider,x,y)
returns: ()
sets the slider position nearest to a pixelposition given by x and y that are in local coordinates of the component.
sliderincrement
{[float]}=0.1 - increment of sliderposition. Can be set per slider. The increment value is used if the mousewheel or the arrow keys have been used.

Inherited Methods:

From Component

acceptSkinBounds, addKeyListener, addMouseListener, addTooltipListener, clipinsets, colors, contains, createVisibles, delete, deleteVisibles, fadeTo, focus, focuscolors, getBottom, getBounds, getClipRect, getFocusComponentAt, getFocusElement, getFocusIndex, getHeight, getLocation, getMinSize, getMouseLock, getMouseLockPos, getParent, getRight, getSize, getSkin, getTooltip, getWidth, getX, getY, hasFocus, hideVisibles, index, invalidate, isClipped, isDisplayedFlag, isFocusable, isMouseLocker, isVisible, isVisibleFlag, keyEvent, keylisteners, local2world, lockMouse, mouseClicked, mouseEntered, mouseEvent, mouseExited, mouseMoved, mousePressed, mouseReleased, mouseWheeled, mouselisteners, moveToRect, new, newFocusOrder, onDestroy, onDisplayChange, onGainedFocus, onLostFocus, onVisibilityChange, positionUpdate, remove, removeKeyListener, removeMouseListener, removeTooltipListener, setBounds, setClip, setColor, setDefaultUI, setDisabled, setDisplayable, setFont, setLocation, setSize, setSkin, setTooltip, setVisibility, showTooltipInformation, showVisibles, skinnames.defaultskin, skinnames.focusedskin, skinnames.hoveredskin, skinnames.pressedskin, think, toString, transferFocus, transferFocusOnArrows, transferFocusOnTab, unlockMouse, updateSkin, validate, validateFocus, white, world2local, zorderoffset