Jump to content

How to Adjust Slider Range?


Haydenmango
 Share

Recommended Posts

I created an audio options menu that has sliders for different sound sources.  The problem is the sliders range seems to be 0-9 and I want it to be 0-10.  I looked in the documentation, these forums, and through the slider script but can't figure out how to change the range.  

Is there anyway to change the slider range?

Link to comment
Share on other sites

local window = Window:Create()
local context = Context:Create(window)
local gui = GUI:Create(context)
local base = gui:GetBase()
base:SetScript("Scripts/GUI/Panel.lua")

x=20
y=20
local sep=30

widget = Widget:Slider(x,y,300,20,base)
y=y+sep

widget = Widget:Slider(x,y,300,20,base)
widget:SetStyle(SLIDER_TRACKBAR)
widget:SetRange(1,20)
y=y+sep

while true do
        if window:Closed() then return end
        if window:KeyHit(Key.Escape) then return end
        
        while EventQueue:Peek() do
                local event = EventQueue:Wait()
                if event.id == Event.WidgetAction then
                        System:Print("WidgetAction")
                elseif event.id == Event.WidgetSelect then
                        System:Print("WidgetSelect")
                end             
        end
        
        context:Sync()
end

 

  • Like 1

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Oh, nice! 

Didn't know widget:SetRange() was a thing.  Just tested it out with my gui and it's working perfectly.  Would be cool to add that command under one or more of the sliders you make in the documentation example. 

Thanks Josh! 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...