docs
This commit is contained in:
@@ -1,42 +1,108 @@
|
||||
With sliders you can add a object where the user can change a number value.<br><br>
|
||||
Sliders are objects, the user can scroll vertically or horizontally, this will change a value, which you can access by :getValue().<br>
|
||||
|
||||
Here are all possible functions available for sliders: <br>
|
||||
Remember slider also inherits from [object](https://github.com/NoryiE/Basalt/wiki/Object)
|
||||
Remember slider also inherits from [Object](objects/Object.md)
|
||||
|
||||
## setSymbol
|
||||
this will change the foreground symbol
|
||||
Changes the slider symbol, default is " "
|
||||
|
||||
#### Parameters:
|
||||
1. `string` symbol
|
||||
|
||||
#### Returns:
|
||||
1. `object` The object in use
|
||||
|
||||
#### Usage:
|
||||
* Creates a new slider and changes the symbol to X
|
||||
```lua
|
||||
local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
||||
local aSlider = mainFrame:addSlider("myFirstSlider"):setSymbol("X"):show()
|
||||
local mainFrame = basalt.createFrame()
|
||||
local slider = mainFrame:addSlider():setSymbol("X")
|
||||
```
|
||||
```xml
|
||||
<slider symbol="X" />
|
||||
```
|
||||
#### Parameters: char symbol<br>
|
||||
#### Returns: self<br>
|
||||
|
||||
## setBackgroundSymbol
|
||||
this will change the symbol background color
|
||||
```lua
|
||||
local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
||||
local aSlider = mainFrame:addSlider("myFirstSlider"):setBackgroundSymbol(colors.yellow):show()
|
||||
```
|
||||
#### Parameters: number color<br>
|
||||
#### Returns: self<br>
|
||||
Changes the symbol in the background, default is "\140"
|
||||
|
||||
## setSymbolColor
|
||||
this will change the symbol color
|
||||
#### Parameters:
|
||||
1. `string` symbol
|
||||
|
||||
#### Returns:
|
||||
1. `object` The object in use
|
||||
|
||||
#### Usage:
|
||||
* Creates a new slider and changes the background symbol to X
|
||||
```lua
|
||||
local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
||||
local aSlider = mainFrame:addSlider("myFirstSlider"):setSymbolColor(colors.red):show()
|
||||
local mainFrame = basalt.createFrame()
|
||||
local slider = mainFrame:addSlider():setBackgroundSymbol("X")
|
||||
```
|
||||
```xml
|
||||
<slider backgroundSymbol="X" />
|
||||
```
|
||||
#### Parameters: number color<br>
|
||||
#### Returns: self<br>
|
||||
|
||||
## setBarType
|
||||
this will change the bar to vertical/horizontal (default is horizontal)
|
||||
Changes the slider to be vertical or horizontal, default is horizontal
|
||||
|
||||
#### Parameters:
|
||||
1. `string` vertical or horizontal
|
||||
|
||||
#### Returns:
|
||||
1. `object` The object in use
|
||||
|
||||
#### Usage:
|
||||
* Creates a new slider and changes the bar type to horizontal
|
||||
```lua
|
||||
local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
||||
local aSlider = mainFrame:addSlider("myFirstSlider"):setBarType("vertical"):show()
|
||||
local mainFrame = basalt.createFrame()
|
||||
local slider = mainFrame:addSlider():setBarType("vertical")
|
||||
```
|
||||
```xml
|
||||
<slider barType="vertical" />
|
||||
```
|
||||
#### Parameters: string value ("vertical", "horizontal"<br>
|
||||
#### Returns: self<br>
|
||||
|
||||
## 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:
|
||||
1. `number` maximum
|
||||
|
||||
#### Returns:
|
||||
1. `object` The object in use
|
||||
|
||||
#### Usage:
|
||||
* Creates a new slider and changes the max value to 20
|
||||
```lua
|
||||
local mainFrame = basalt.createFrame()
|
||||
local slider = mainFrame:addSlider():setMaxValue(20)
|
||||
```
|
||||
```xml
|
||||
<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:
|
||||
1. `number` the index
|
||||
|
||||
#### Returns:
|
||||
1. `object` The object in use
|
||||
|
||||
#### Usage:
|
||||
* Creates a new slider and changes the index to 1 as soon as the button got clicked
|
||||
```lua
|
||||
local mainFrame = basalt.createFrame()
|
||||
local slider = mainFrame:addSlider():setMaxValue(20)
|
||||
local button = mainFrame:addButton(function()
|
||||
slider:setIndex(1)
|
||||
end)
|
||||
```
|
||||
```xml
|
||||
<slider index="2" />
|
||||
```
|
||||
|
||||
## getIndex
|
||||
Returns the current index
|
||||
|
||||
#### Returns:
|
||||
1. `number` index
|
||||
|
||||
|
||||
Reference in New Issue
Block a user