Last updated at 12:51 pm UTC on 31 October 2017
MenuMorph is the primary Morphic menu class. This page refers to the 4.5 state of MenuMorph.
Menus can be as simple as a plain list of text...
| menu |
menu := MenuMorph new defaultTarget: self .
menu add: 'show' action: #makeVisible.
menu add: 'export this sprite' action: #exportObject.
menu add: 'duplicate' action: #duplicateNoAttach.
menu add: 'delete' action: #undoableDeleteSprite.
or have icons, submenus, titles, help balloons and inter-item lines...
The menu has a list of MenuItemMorphs which are typically built with messages such as
see the 'construction' protocol in MenuMorph.
Each item needs a target to which the relevant selector is sent; an argument (or list of arguments) can be attached as well.
The target can be provided as a default or explicitly for each item.