Difference between revisions of "UI.Slider"
From GiderosMobile
Line 79: | Line 79: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | {{ | + | {{UI}} |
Latest revision as of 07:19, 17 October 2023
Available since: Gideros 2023.1
Class: UI
Description
Creates Slider widgets. The widget can be a Slider, or an ArcSlider. Sliders give value from 0 to 1.
UI.Slider.new(direction,svgpath,resolution,dual,offset)
UI.ArcSlider.new(astart,aend,resolution,dual,offset)
Parameters
direction: (bool) is the Slider widget vertical default = true
svgpath: (string) the Slider widget svg path
resolution: (number) the Slider widget step increment
dual: (bool) has the Slider widget two knobs default = false
offset: (number) the Slider widget knob offset
astart: (number) the Slider widget start angle value
aend: (number) the Slider widget end angle value
Examples
An SVG Slider
local svg = "M0.6,17.9c7.6,0,13.8,6.3,13.8,14.1L32,32C32,14.3,17.9,0,0.6,0V17.9z"
local gui = UI.Slider.new(false, svg, 0.2, true)
gui:setDimensions(160, 160)
--gui:setVertical(false)
gui:setColor(0xaa0000)
gui:setPosition(50, 50)
--gui:setResolution(0.25)
gui:setCenter(0.4)
gui:setKnobPosition(0.4)
stage:addChild(gui)
An ArcSlider
local gui = UI.ArcSlider.new(5, 60, 0.1, true, 0.1)
gui:setDimensions(128, 128)
--gui:setVertical(false)
gui:setColor(0xaa0000)
gui:setPosition(50, 50)
--gui:setResolution(0.25)
--gui:setCenter(0.25)
--gui:setKnobPosition(0.25)
stage:addChild(gui)
onWidgetChange
--Sliders give value from 0 to 1
local sliderA=UI.Slider.new()
sliderA:setDimensions(200,50)
sliderA:setPosition(250,50)
sliderA.name="Slider A"
local sliderB=UI.Slider.new()
sliderB:setDimensions(200,50)
sliderB:setPosition(250,150)
--This slider center is in the middle of the range
sliderB:setCenter(.5)
--Initial value is .6
sliderB:setKnobPosition(.6)
--Discrete steps of .1
sliderB:setResolution(.1)
sliderB.name="Slider B"
stage:addChild(sliderA)
stage:addChild(sliderB)
--Here we put the WidgetAction listener on stage.
--It will be propagated from each button up to stage through the sprite tree
--First parameter of event listeners are always the source widget of the event
function stage:onWidgetChange(w,v)
print(w.name.." value is "..v)
end
- UI.Accordion
- UI.Animation
- UI.Bar
- UI.Behavior
- UI.Border
- UI.BreadCrumbs
- UI.Builder
- UI.Button
- UI.Calendar
- UI.Checkbox
- UI.Combobox
- UI.ImageText
- UI.Keyboard
- UI.Label
- UI.Panel
- UI.Progress
- UI.Slider
- UI.Spinner
- UI.Splitpane
- UI.TabbedPane
- UI.Table
- UI.TextField
- UI.TimePicker
- UI.Toolbox
- UI.Tree
- UI.Viewport
- UI.WeekSchedule