Difference between revisions of "UI.Tree"

From GiderosMobile
(Created page with "__NOTOC__ '''Available since:''' Gideros 2023.1<br/> '''Class:''' UI<br/> === Description === Creates a Tree widget. <syntaxhighlight lang="lua"> UI.Tree.new() </syntaxhi...")
 
 
Line 45: Line 45:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
{{GIDEROS IMPORTANT LINKS}}
+
{{UI}}

Latest revision as of 07:21, 17 October 2023

Available since: Gideros 2023.1
Class: UI

Description

Creates a Tree widget.

UI.Tree.new()

Example

local dataMapper=function(item) 
	if type(item)=="string" then 
		return item
	else
		return item.name,item.sub
	end
end
local data = {
	{ name="Root",
		sub={
			"A",
			"B",
			{ name="C",
				sub={
					"1",
					{ name="2",
						sub={"a","b"}
					},
			"3"}},
		"D",
		}
	}
}
local gui = UI.Tree.new()
gui:setDimensions(96, 128)
gui:setColor(0x5c5c5c)
gui:setPosition(50, 50)

gui:setData(data, dataMapper)

local screen=UI.Screen.new()
screen:ui(gui)