Hello!
This is my weekly ChangeLog, from 11 March 2019 to 17 March 2019. You can see it in a better format by going here: http://log.smallworks.eu/web/search?from=11/3/2019&to=17/3/2019 ChangeLog ========= 14 March 2019: -------------- * I've been working on context menus for Spec 2. This seems like an easy task... until you see how broken it was in the previous version. In fact, in older Spec menus were inexistent. Or better: the abstraction for menus were inexistent, and instead it was just a simple exposition (at Spec level) of the Morphic menu infrastructure (which itself is not very friendly). So... I needed to reimplement everything. ... and a way to test it :( Now, I want to consider the Menu interface more in detail, since today is not very clear. Look how a Menu Bar needs to be made: ---- MenuBarPresenter new addGroup: [ :group | group addItem: [ :item | item name: 'Something 1'; action: [ "doSomething"] ]; addMenu: [ :item | item name: 'Something 2'; action: [ "doSomething"] ] ]; yourself ---- which doesn't seems to be the best approach. (Anyway, I'm not changing that just now... but I'm reflecting on it, certainly) 13 March 2019: -------------- * I made a pause of my Spec 2 current work to make a fix that was pending since some time now and it was needed to easy the migration of some projects (and its usage in windows): This [PR](https://github.com/pharo-vcs/iceberg/pull/1213) will fix [tonel issue 74](https://github.com/pharo-vcs/tonel/issues/74) cheers! Esteban |
Administrator
|
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
Cheers,
Sean |
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 <[hidden email]> 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 > |
> On 18 Mar 2019, at 18:00, Esteban Lorenzano <[hidden email]> wrote: > > 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 :) I think that Spec should propose a nice default way. And as Sean mentioned it, I’m not unable to nicely extend Epicea menu so I’m hacking inside and this is not good. > > 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 <[hidden email]> 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 >> > > |
Hi,
> On 18 Mar 2019, at 20:27, ducasse <[hidden email]> wrote: > > > >> On 18 Mar 2019, at 18:00, Esteban Lorenzano <[hidden email]> wrote: >> >> 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 :) > > > I think that Spec should propose a nice default way. We will have a default way. But everybody can do whatever they want after that :) > And as Sean mentioned it, I’m not unable to nicely extend Epicea menu so I’m hacking inside and this is not good. Because it was not designed to be extensible (as nothing was before we started to pay attention to that) Esteban >> >> 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 <[hidden email]> 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 >>> >> >> > > > |
Free forum by Nabble | Edit this page |