Hi Sean, This is how the menus are done ultimately, not âthe wayâ of doing it. In general, you will do menus using something like Commander: you define commands, then you dynamically build the menus based on a context given (this is how Pharo itself will doit). - Or you build your own command library and build menus your way (see this experiment: https://github.com/estebanlm/Lieutenant/tree/try-superlight-version and its clases LtMenuBarBuilder, LtContextMenuBuilder). - Or you collect the items (MenuItemPresenter) from a pragma and you sort them some way. You are free to do as you want, but at the end, it has to have the structure described in the log :) One important things I didnât remarked, is that in Spec, all menu accessors are âvaluablesâ. Means that for example ListPresenter>>contextMenu: will receive anything that understands value and it will be executed on demand: self newList contextMenu: [ self collectMyContextMenu ]; etcâ¦. Will work as expected. (I hope this helps to understand the design better). Cheers! Esteban
On 18 Mar 2019, at 17:06, Sean P. DeNigris <sean@clipperadams.com> wrote:
EstebanLM wrote
addGroup: [ :group | group addItem: [ :item | item name: 'Something 1'; action: [ "doSomething"] ];
How would one extend a menu with this approach e.g. add an item to the group from elsewhere (outside the block)? Is it even possible?
----- Cheers, Sean -- Sent from: http://forum.world.st/Pharo-Smalltalk-Developers-f1294837.html