From b6114ca8da676e98c435e53404c1f810681915a9 Mon Sep 17 00:00:00 2001 From: Robert Jelic <36573031+NoryiE@users.noreply.github.com> Date: Thu, 18 May 2023 22:09:23 +0200 Subject: [PATCH] Update Scrollbar.md Updated scrollbar example to make more sense --- docs/objects/Scrollbar.md | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/docs/objects/Scrollbar.md b/docs/objects/Scrollbar.md index 0c8f835..0c3e2fe 100644 --- a/docs/objects/Scrollbar.md +++ b/docs/objects/Scrollbar.md @@ -16,14 +16,11 @@ In addition to the Object and VisualObject methods, Scrollbar objects have the f Here's an example of how to create a Scrollbar object and set its properties: ```lua -local mainFrame = basalt.createFrame() -local scrollbar = mainFrame:addScrollbar() +local main = basalt.createFrame() +local subFrame = main:addFrame():setSize(30, 15) +local scrollbar = main:addScrollbar():setPosition(31, 1):setSize(1, 15):setScrollAmount(10) -scrollbar:setBarType("vertical") -scrollbar:setScrollAmount(100) -scrollbar:setIndex(50) - -scrollbar:onChange(function(self, event, value) - basalt.debug("Scrollbar value changed to:", value.text) +scrollbar:onChange(function(self, _, value) + subFrame:setOffset(0, value-1) end) ```