MenuItem
Properties
MacGap.MenuItem.label
gets or sets menu item’s label
MacGap.Menu.getItem("Files").label = "File";
MacGap.MenuItem.submenu
gets or sets menu item’s submenu
var fileMenu = MacGap.Menu.getItem("File").submenu;
MacGap.MenuItem.callback
gets or sets menu item’s callback function – this is the function that will be called when the menu item is clicked
MacGap.Menu.getItem("File").submenu.getItem("Open").callback = function() { MacGap.Dialog.openDialog(); };
MacGap.MenuItem.enabled
enable or disable the menu item by passing true or false
note: this only works for menus created with MacGap. Menu items added in Interface Builder cannot be modified this way. If you want to control enabling/disabling menu items via Javascript, use MacGap.Menu.addItem
MacGap.Menu.getItem("File").submenu.getItem("Open").enabled = false;
Methods
MacGap.MenuItem.addSubmenu(title)
Add a submenu with an optional title
MacGap.Menu.getItem("File").addSubmenu();
MacGap.MenuItem.setKey(keys)
Set menu item’s key shortcut
MacGap.Menu.getItem("File").submenu.getItem("Open").setKey('cmd+o');
MacGap.MenuItem.remove()
Remove a menu item
MacGap.Menu.getItem("File").submenu.getItem("Open").remove();