UI.TabbedPane

From GiderosMobile
Revision as of 08:40, 17 October 2023 by MoKaLux (talk | contribs) (merci hgy29 ;-))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Available since: Gideros 2023.1
Class: UI

Description

Creates a TabbedPane widget.

UI.TabbedPane.new()

Example

local tabs={
	{ title="Header 1", content= "My first Tab content." },
	{ title="Header 2", content= "My second Tab content." },
	{ title="Header 3", content= "My 3rd Tab content." },
}
 
local vp=UI.Viewport.new()
vp:setDimensions(480, 320)
vp:setScrollbar({UI.Viewport.SCROLLBAR.AUTO,UI.Viewport.SCROLLBAR.ALWAYS})
 
local gui=UI.TabbedPane.new()
gui:setLayoutConstraints({fill=1})
vp:setContent(gui)
 
local function builder(v)
	local hdr=UI.Label.new(v.title)
	hdr:setStyle({ font="font.bold", ["label.color"]="colHighlight", colWidgetBack="colHeader"})
	local lb=UI.Label.new(v.content,{ flags=FontBase.TLF_BREAKWORDS|FontBase.TLF_REF_TOP })
	lb:setLayoutConstraints({fill=1})
	-- Return header and content
	return hdr,lb
end
gui:setData(tabs,builder) --builder function will be called for each value in the values table
 
stage:addChild(vp)