limekit docs
latest
  • Installation
  • Widgets
    • Accordion
    • Button
    • ButtonGroup
    • Calendar
    • CheckBox
    • ComboBox
    • CommandButton
    • DatePicker
    • Dock
    • DoubleSpinner
    • GifPlayer
    • GroupBox
    • HLine
    • Image
    • Knob
    • Label
    • LineEdit
    • ListBox
    • Menu
    • MenuBar
      • Properties
        • buildFromTemplate()
        • getChild()
    • Modal
    • ProgressBar
    • RadioButton
    • Scroller
    • Slider
    • SlidingStackedWidget
    • Splitter
    • Spinner
    • Tab
    • Table
    • TextField
    • TimePicker
    • ToolBar
    • VLine
    • Window
  • Widget Items
  • Layout Managers
  • App object
  • Accessing Resources
  • Batteries included
limekit docs
  • Widgets
  • MenuBar
  • Edit on GitHub

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 when name was used on a submenu inside buildFromTemplate.

Previous Next

© Copyright 2023, Take bytes. Revision 725a7c2a.

Built with Sphinx using a theme provided by Read the Docs.