Difference between revisions of "UI.Spinner"
From GiderosMobile
(Created page with "__NOTOC__ '''Available since:''' Gideros 2023.1<br/> '''Class:''' UI<br/> === Description === Creates a Spinner widget. <syntaxhighlight lang="lua"> UI.Spinner.new(params...") |
|||
(One intermediate revision by the same user not shown) | |||
Line 19: | Line 19: | ||
'''params''': (table) the default parameters for the Spinner widget<br/> | '''params''': (table) the default parameters for the Spinner widget<br/> | ||
− | === | + | === Examples === |
+ | '''With Numbers''' | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
local gui = UI.Spinner.new({Min=0, Max=100, Step=10, Format="Done: %d%%", Looping=true}) | local gui = UI.Spinner.new({Min=0, Max=100, Step=10, Format="Done: %d%%", Looping=true}) | ||
Line 34: | Line 35: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | {{ | + | '''With Strings''' |
+ | <syntaxhighlight lang="lua"> | ||
+ | local data = { "A", "B", "C", "D", "E" } | ||
+ | local gui = UI.Spinner.new(data) | ||
+ | gui:setDimensions(128, 32) | ||
+ | gui:setColor(0xaacc00) | ||
+ | gui:setPosition(50, 50) | ||
+ | |||
+ | function gui:onWidgetChange(w) | ||
+ | print(w.value) | ||
+ | end | ||
+ | |||
+ | local screen=UI.Screen.new() -- needed to add the Spinner widget arrows | ||
+ | screen:ui(gui) | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | {{UI}} |
Latest revision as of 07:20, 17 October 2023
Available since: Gideros 2023.1
Class: UI
Description
Creates a Spinner widget.
UI.Spinner.new(params)
params is a table which can have the following properties:
- Min: (number) the minimum Spinner widget value
- Max: (number) the maximum Spinner widget value
- Step: (number) the Spinner widget steps increment value
- Format: (string) the Spinner widget text format
- Looping: (bool) allows the Spinner widget value to loop (default = false)
Parameters
params: (table) the default parameters for the Spinner widget
Examples
With Numbers
local gui = UI.Spinner.new({Min=0, Max=100, Step=10, Format="Done: %d%%", Looping=true})
gui:setDimensions(128, 32)
gui:setColor(0xaacc00)
gui:setPosition(50, 50)
function gui:onWidgetChange(w)
print(w.value)
end
local screen=UI.Screen.new() -- needed to add the Spinner widget arrows
screen:ui(gui)
With Strings
local data = { "A", "B", "C", "D", "E" }
local gui = UI.Spinner.new(data)
gui:setDimensions(128, 32)
gui:setColor(0xaacc00)
gui:setPosition(50, 50)
function gui:onWidgetChange(w)
print(w.value)
end
local screen=UI.Screen.new() -- needed to add the Spinner widget arrows
screen:ui(gui)
- 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