Skip to content

Commit b6114ca

Browse files
committed
Update Scrollbar.md
Updated scrollbar example to make more sense
1 parent 89d1eff commit b6114ca

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

docs/objects/Scrollbar.md

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,11 @@ In addition to the Object and VisualObject methods, Scrollbar objects have the f
1616
Here's an example of how to create a Scrollbar object and set its properties:
1717

1818
```lua
19-
local mainFrame = basalt.createFrame()
20-
local scrollbar = mainFrame:addScrollbar()
19+
local main = basalt.createFrame()
20+
local subFrame = main:addFrame():setSize(30, 15)
21+
local scrollbar = main:addScrollbar():setPosition(31, 1):setSize(1, 15):setScrollAmount(10)
2122

22-
scrollbar:setBarType("vertical")
23-
scrollbar:setScrollAmount(100)
24-
scrollbar:setIndex(50)
25-
26-
scrollbar:onChange(function(self, event, value)
27-
basalt.debug("Scrollbar value changed to:", value.text)
23+
scrollbar:onChange(function(self, _, value)
24+
subFrame:setOffset(0, value-1)
2825
end)
2926
```

0 commit comments

Comments
 (0)