2.6 KiB
Sliders are objects, the user can scroll vertically or horizontally, this will change a value, which you can access by :getValue().
Remember slider also inherits from Object
setSymbol
Changes the slider symbol, default is " "
Parameters:
stringsymbol
Returns:
objectThe object in use
Usage:
- Creates a new slider and changes the symbol to X
local mainFrame = basalt.createFrame()
local slider = mainFrame:addSlider():setSymbol("X")
<slider symbol="X" />
setBackgroundSymbol
Changes the symbol in the background, default is "\140"
Parameters:
stringsymbol
Returns:
objectThe object in use
Usage:
- Creates a new slider and changes the background symbol to X
local mainFrame = basalt.createFrame()
local slider = mainFrame:addSlider():setBackgroundSymbol("X")
<slider backgroundSymbol="X" />
setBarType
Changes the slider to be vertical or horizontal, default is horizontal
Parameters:
stringvertical or horizontal
Returns:
objectThe object in use
Usage:
- Creates a new slider and changes the bar type to horizontal
local mainFrame = basalt.createFrame()
local slider = mainFrame:addSlider():setBarType("vertical")
<slider barType="vertical" />
setMaxValue
the default max value is always the width (if horizontal) or height (if vertical), if you change the max value the bar will always calculate the value based on its width or height - example: you set the max value to 100, the height is 10 and it is a vertical bar, this means if the bar is on top, the value is 10, if the bar goes one below, it is 20 and so on.
Parameters:
numbermaximum
Returns:
objectThe object in use
Usage:
- Creates a new slider and changes the max value to 20
local mainFrame = basalt.createFrame()
local slider = mainFrame:addSlider():setMaxValue(20)
<slider maxValue="20" />
setIndex
Changes the current index to your choice, for example you could create a button which scrolls up to 1 by using :setIndex(1)
Parameters:
numberthe index
Returns:
objectThe object in use
Usage:
- Creates a new slider and changes the index to 1 as soon as the button got clicked
local mainFrame = basalt.createFrame()
local slider = mainFrame:addSlider():setMaxValue(20)
local button = mainFrame:addButton(function()
slider:setIndex(1)
end)
<slider index="2" />
getIndex
Returns the current index
Returns:
numberindex