Menu:remove(index | item) method
Remove an existing item from the Menu.
Parameters
index | item
A number representing the item index, or the MenuItem to be removed.
Return value
This method returns no value.Example
local ui = require "ui"
-- create a simple Window
local win = ui.Window("Menu:remove() sample", 316, 246)
-- create a Window menu with one menu item "Items" with a 3 items submenu
win.menu = ui.Menu()
local items = win.menu:add("Items")
items.submenu = ui.Menu("Remove Item1", "Remove Item2", "Remove Item3")
function items.submenu:onClick(item)
win:status(item.text.." has been removed")
items.submenu:remove(item)
end
-- shows the Window
win:show()
-- update user interface
repeat
ui.update()
until not win.visible