Add a menu to the MenuBar of the Main Window. Menu is an instance of the Menu GUI class.
Will not add if another menu of the same label already exists in the menu bar.
Note :- Menu of same label may exist in a menu inside a menu of the menu bar i.e. more than one level away from the menu bar.
local menu1 = mainWindow:addMenu("Test")
local menu1 = gui.Menu("Test") mainWindow:addMenu(menu1)
Return pointer to menu of the given name or position present in the menu bar. Returns nullptr if not present.
local menu1 = mainWindow:menuByName("Test")
local menu2 = mainWindow:menuByPosition(2)
Remove menu of the given name or at the given position from the menu bar. Does nothing if menu does not exist in the menu bar.
mainWindow:removeMenu("Test")
mainWindow:removeMenu(2)
Find and return the first menu item found of the given label/object name present in any of the menus recursively (menu bar as well as menus inside other menus).
local item1 = mainWindow:findMenuItem("Ellipse")
local item2 = mainWindow:findMenuItemByObjectName("actionNew")