MenuMorph
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 addLine.
menu add: 'duplicate' action: #duplicateNoAttach.
menu add: 'delete' action: #undoableDeleteSprite.
menu popUpInWorld
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
- #add:action:
- #add:selector:argument:
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.
PopUp menu
aMenu popUpInWorld
See also