From release 1.27, you can have tabs in your lua user interface. Tabs are similar to groups or panel stacks. They take a list of children, one for each tab. The tab component is resized to fit it's largest child component. Here's an example script:
- Code: Select all
--
-- Tabbed component creation example
--
local button = octane.gui.create
{
type = octane.gui.componentType.BUTTON,
width = 100,
height = 24,
x = 20,
y = 20,
text = "Button",
}
local table = octane.gui.create
{
type = octane.gui.componentType.TABLE,
header = { "animal", "friendly" },
items =
{
"cat" , "no" ,
"dog" , "yes",
"dolphin" , "yes",
"shark" , "no" ,
"tiger" , "no" ,
"bear" , "no" ,
"seal" , "yes",
"horse" , "yes",
"eagle" , "no" ,
"zebra" , "no" ,
"elephant", "no" ,
"hippo" , "no" ,
}
,
widths = { 200, 200},
height = 400,
selectedRow = 2,
}
local tabs = octane.gui.create
{
type = octane.gui.componentType.TABS,
children = { table, button }, -- components, 1 for each tab
header = { "Animals", "Button" }, -- text to appear on each tab
currentTab = 1, -- the initially selected tab
callback = function(comp, evt) print("Current tab: ", comp:getProperties().currentTab) end
}
local window = octane.gui.create
{
type = octane.gui.componentType.WINDOW,
width = tabs:getProperties().width,
height = tabs:getProperties().height,
children = { tabs },
text = "Tabs Example",
}
window:showWindow()
Here's how it looks:
cheers,
Thomas