Skip to content
coding.jackalope edited this page Feb 24, 2019 · 12 revisions

Trees allow data to be viewed in hierarchy. Trees can also contain leaf nodes which have no children.

Slab.BeginWindow('MyFirstWindow', {Title = "My First Window"})

if Slab.BeginTree('Root 1') then
	if Slab.BeginTree('Child 1') then
		Slab.EndTree()
	end

	Slab.BeginTree('Leaf 1', {IsLeaf = true})

	Slab.EndTree()
end

if Slab.BeginTree('Root_2', {Label = "Root 2"}) then
	Slab.BeginTree('Leaf_2', {Label = "Leaf 2", IsLeaf = true})

	if Slab.BeginTree('Child_2', {Label = "Child 2"}) then
		Slab.BeginTree('Leaf_3', {Label = "Leaf 3", IsLeaf = true})
		Slab.EndTree()
	end
	Slab.EndTree()
end

Slab.EndWindow()

Trees can be configured to only open when the arrow is clicked instead of the row.

Slab.BeginWindow('MyFirstWindow', {Title = "My First Window"})

if Slab.BeginTree('Root 1', {OpenWithHighlight = false}) then
	Slab.BeginTree('Leaf 1', {IsLeaf = true})

	Slab.EndTree()
end

Slab.EndWindow()

Options

There are a few options which can be configured to change the behavior of the Input control.

Option Type Description
Label String The text to be rendered for this tree item.
Tooltip String The text to be rendered when the user hovers over this tree item.
IsLeaf Boolean If this is true, this tree item will not be expandable/collapsable.
OpenWithHighlight Boolean If this is true, the tree will be expanded/collapsed when the user hovers over the hot zone of this tree item. If this is false, the user must click the expand/collapse icon to interact with this tree item.
Clone this wiki locally