CocoaMenuItem additional item in the menu bar


superclass: Object


for interoperability this class is called via GUI.menuItem


*new(parent, index, name, hasSubmenu, action)

parent the branch to fork from (another instance of CocoaMenuItem, if nil it is the top one)

index the place in the order of menus

name name displayed as menu item

hasSubmenue if it is supposed to be a branch, true (default: false)

action action to evaluate when menu is selected and activated



*add(names, action)  

add a submenu to the Library menu. 

Avoiding clutter, this is suggested default method, rather than *new.

names array of names to indicate the submenu path

action action to evaluate when menu is selected and activated

*clearCustomItems clear all added library menus (DOES NOT WORK PROPERLY YET)


enabled_(bool) enable / disable

setShortCut(string, alt, ctrl) set keyboard shortcut





// examples: call by GUI method.

GUI.menuItem.add(["hallo", "world"], { "hallo menu".postln });

GUI.menuItem.add(["hallo", "world", "here"], { "hallo here".postln }); // fails correctly

GUI.menuItem.add(["mellow", "world", "here"], { "mellow here".postln }); // works.

GUI.menuItem.add(["hallo", "thought"], { "hallo world".scramble.postln });