MenuItem.enabled read/write

Get or set the MenuItem enabled state, a boolean value.
When set to false, the MenuItem is disabled and cannot receive events anymore.

Example

local ui = require "ui" -- create a simple Window local win = ui.Window("MenuItem.enabled sample", 316, 246) win.menu = ui.Menu() -- insert a new MenuItem "File" with a submenu local FileMenu = win.menu:insert(1, "File", ui.Menu("New", "Open", "Save", "Quit")).submenu -- disable FileMenu item "New" FileMenu.items[1].enabled = false -- set a FileMenu onClick() event handler function FileMenu:onClick(item) if item.index == self.count then win.visible = false else ui.info("You have selected '"..item.text.."'") end end -- shows the Window win:show() -- update user interface repeat ui.update() until not win.visible