UI.Spinner

From GiderosMobile

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)