MenuItem
A powerful component designed to manage and display multiple tabs, each hosting distinct set of widgets or layouts but only one item can stay open at a time
local accordion = Accordion()
You can add a widget or a layout to the accordion using addChild(widget, label, icon: optional)
or addLayout(layout, label, icon: optional)
, respectively. Take a look at the different code snippet below
Adding a widget
local button = Button('Click me')
accordion:addChild(button, 'All Buttons')
-- or otherwise with an icon
local button = Button('Click me')
accordion:addChild(button, 'All Buttons', images('icon.png'))
Adding a layout
local layout = VLayout()
local button = Button('Click me')
layout:addChild(button)
accordion:addChild(layout, 'All Buttons')
-- or otherwise with an icon
local layout = VLayout()
local button = Button('Click me')
layout:addChild(button)
accordion:addChild(layout, 'All Buttons')
checkout Layout Managers
Properties
- addChild(widget, label, icon: optional)
Adds a widget in a tab to the accordion with given a label, and icon if necessary
- addLayout(layout, label, icon: optional)
Adds a layout in a tab to the accordion with given a label, and icon if necessary
checkout Using resources
- setToolTip(text)
Enable text that appears when a mouse hovers on the tab
- getCurrentIndex()
Gets the current index of the visible tab
- setCurrentIndex(index)
Sets the index of the tab to be visible