MenuItem:remove()method

Removes the MenuItem from the Menu it belongs to.

Return value

This method returns no value.

Example

--! luart-extensions import ui -- create a simple Window local win = ui.Window("MenuItem:remove() sample", 316, 246) local button = ui.Button(win, "Remove 'Items'", 100, 86) -- create a Window menu win.menu = ui.Menu("Stock", "Commands") -- insert a "Items" submenu at second position win.menu:insert(2, "Items", ui.Menu("Item 1", "Item 2", "Item 3")).submenu.onClick = function (self, item) ui.info("You have clicked on "..item.text) end -- remove "Items" submenu function button:onClick() win.menu.items[2]:remove() end -- shows the Window win:show() -- update user interface repeat ui.update() until not win.visible