Closed JanBliznicenko closed 2 years ago
it is indeed removed. Solution is not use Specs (which are something made to do MenuMorphs) but direct presenters, which are, in a way, also "specs" :P
Ok, then these methods like SpMenuPresenter>>#fromSpec:
should be deprecated and removed as well, right?
What about package MenuRegistration?
I will probably create alternative to this (generating menu from pragmas) that would generate Spec2 menu-related instances instead of these Morhpic specs.
A nice way to define a menu in Spec 2 is to define commander 2 commands, add a asSpecCommand
method on the commands. Then you define a Command group that contains commands of the menu. Last, you use contextMenuFromCommandsGroup: commandGroup
on your presenter to set the context menu
Thank you, @demarey, for your help - I am moving OpenPonk from Pharo 8-. Actually, it is not a context menu, but button on menu bar that opens menu with multiple menu groups (ie. menu with splitters):
Is that (including menu groups) achievable with Commander2 as well?
Command 2 command groups can be easily added to any menu presenter. You should be able to define a group for diagram
containing a first group with one command, a second group with 2 commands and the last one with 5 commands.
Then, you can instantiate a SpMenuButtonPresenter
and set its menu with #menu: diagramGroup asMenuPresenter
Thank you very much, @demarey, your explanation helped me a lot.
Method
SpMenuPresenter>>#addAllFromPragma:target:
calls methodSpMenuPresenter>>#fromSpec:
. Neither is marked as TOREMOVE nor deprecated. However, thisfromSpec:
method callsSpMenuItemPresenter>>#fromSpec:
that has been marked as TOREMOVE in Pharo 9 and has been removed in Pharo 10. Result isInstance of SpMenuItemPresenter did not understand #fromSpec:
.Is there any alternative or should it be fixed?