- New Objects (Flexbox, Graph, Treeview) - Pluginsystem to add/remove functionality - Reworked the entire Object system, instead of one big Object Class we have multiple classes: Object, VisualObject, ChangeableObject - Instead of one big Frame Class we have multiple Frame Classes: BaseFrame, Frame, MovableFrame, ScrollableFrame, MonitorFrame, Flexbox - Removed the Animation Object, and added a animation plugin instead - Removed the Graphic Object and merged it's functionality with the image object - Updated currently existing objects
1.1 KiB
1.1 KiB
setIndex
Description
Changes the current index to your choice. For example, you could create a button that scrolls up to index 1 by using setIndex(1).
Parameters
numberthe index
Returns
objectThe object in use
Usage
- Create a new scrollbar and change the index to 1 when the button is clicked:
local basalt = require("basalt")
local mainFrame = basalt.createFrame()
local scrollbar = mainFrame:addScrollbar()
:setPosition(3, 3)
:setSize(1, 10)
:setMaxValue(20)
local button = mainFrame:addButton()
:setPosition(5, 3)
:setSize(10, 3)
:setText("Set index to 1")
:onClick(function()
scrollbar:setIndex(1)
end)
basalt.autoUpdate()
In this example, a Scrollbar object is created and added to the mainFrame. The setPosition and setSize methods are used to adjust the position and size of the Scrollbar. The setMaxValue method is used to set the maximum value of the Scrollbar. A Button object is also created and added to the mainFrame. The onClick method is used to add a custom event that changes the index of the Scrollbar to 1 when the button is clicked.
<scrollbar index="2" />