MenuBar
This widget provides a horizontal bar typically placed at the top of the application window, containing various menus. Each menu can hold menu items, which when clicked, can trigger specific actions or open sub-menus. The MenuBar widget is an essential component for organizing and providing access to different functionalities or commands within an application.
local menubar = MenuBar()
checkout MenuItems
Note
It is highly recommended to use the buildFromTemplate(template)
as this saves you a lot of time from individualy creating MenuItem
objects. This powerful features uses tables
Properties
- buildFromTemplate(template: table)
A powerful features that allows developing complex menus using tables.
local menubar = MenuBar(); menubar:buildFromTemplate({{ label = '&File', submenu = {{ label = 'New File', name = 'new_file', shortcut = "Ctrl+N", icon = images('newfile.png'), click = createFileFunc}} }, { label = 'Help', submenu = {{ label = 'About'}} }})
The preceding code example illustrates the capabilities of the
buildFromTemplate
function, showcasing its power in creating a sample menubar using tables
- getChild(name)
Returns the
MenuItem
widget assigned with the name. This only applies whenname
was used on asubmenu
insidebuildFromTemplate
.