1.1 KiB
1.1 KiB
Scrollbars are objects that allow users to scroll vertically or horizontally, which in turn changes a value that you can access using the :getValue() method.
In addition to the Object and VisualObject methods, Scrollbar objects have the following methods:
| setSymbol | Sets the scrollbar symbol |
| setBackgroundSymbol | Sets the background symbol |
| setBarType | Sets the bar type (vertical or horizontal) |
| setScrollAmount | Sets the maximum scroll amount |
| setIndex | Sets the current index |
| getIndex | Returns the index |
Example
Here's an example of how to create a Scrollbar object and set its properties:
local mainFrame = basalt.createFrame()
local scrollbar = mainFrame:addScrollbar()
scrollbar:setBarType("vertical")
scrollbar:setScrollAmount(100)
scrollbar:setIndex(50)
scrollbar:onChange(function(self, event, value)
basalt.debug("Scrollbar value changed to:", value.text)
end)