Building a simple UI with Spec. Problem with menus.

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Building a simple UI with Spec. Problem with menus.

nacho
Hi, this is my first post in the Pharo group.
I'm developing a simple Text Editor with some nice features as a way to understand how Spec works. It seems that Spec will be the default UI framework from Pharo 3 onwards, I know it's changing and evolving but I'll take the risk.
The problem I'm facing is that I'm lost at trying to add a "Save as..." option in the menu.
It seems that Spec is still using the Morphic MenuMorph>>ToggleMenuItemMorph but it's not clear to me hoy to add this item.
On the other hand, inspecting the ComposableModel class, it seem that in the future this will be done directly in Spec as suggested by the ComposableModel>>addMenuItemsToWindowMenu:
But so far that method simply says "do nothing".
Any help?
Thanks in advance
Cheers
Nacho
Nacho Smalltalker apprentice. Buenos Aires, Argentina.
Reply | Threaded
Open this post in threaded view
|

Re: Building a simple UI with Spec. Problem with menus.

Ben Coman
nacho wrote:

> Hi, this is my first post in the Pharo group.
> I'm developing a simple Text Editor with some nice features as a way to
> understand how Spec works. It seems that Spec will be the default UI
> framework from Pharo 3 onwards, I know it's changing and evolving but I'll
> take the risk.
> The problem I'm facing is that I'm lost at trying to add a "Save as..."
> option in the menu.
> It seems that Spec is still using the Morphic MenuMorph>>ToggleMenuItemMorph
> but it's not clear to me hoy to add this item.
> On the other hand, inspecting the ComposableModel class, it seem that in the
> future this will be done directly in Spec as suggested by the
> ComposableModel>>addMenuItemsToWindowMenu:
> But so far that method simply says "do nothing".
> Any help?
> Thanks in advance
> Cheers
> Nacho
>
>  
Check ComposableModel subclass WindowModel.  I believe
#addMenuItemsToWindowMenu: is just for the Window Menu (the small
downward pointing arrow in the title bar) - so it doesn't apply to other
ComposableModel subclasses like ListModel, etc.

cheers -ben

Reply | Threaded
Open this post in threaded view
|

Re: Building a simple UI with Spec. Problem with menus.

Benjamin Van Ryseghem (Pharo)
In reply to this post by nacho
Hello and welcome :)


On 03 Nov 2013, at 18:36, nacho <[hidden email]> wrote:

> Hi, this is my first post in the Pharo group.
> I'm developing a simple Text Editor with some nice features as a way to
> understand how Spec works. It seems that Spec will be the default UI
> framework from Pharo 3 onwards, I know it's changing and evolving but I'll
> take the risk.

Good to hear :) It is quite changing now, but should not change a lot starting from now (plus a couple of days
waiting for the last changes to be integrated).

> The problem I'm facing is that I'm lost at trying to add a "Save as..."
> option in the menu.

As far as I know, there is a bug in TextModel where the menu is hardcoded, and therefor can not be changed.
In addition, as you have said, it is currently using directly Morphic menus that is bad.

The issue 12051 [1] introduces Spec models for menus. The fix has yet to be integrated.
So there are two solutions :)
1) You wait a bit tip this issue is integrated, and the TextModel problem solved (which should be done tonight)
2) You load locally the patches so you can try :)
If you wanna do so you need to take the latest image and to merge the slices:
        - 11920 (this one will give you merge conflicts, you can safely take all the incoming versions)
        - 12051.
        - 11819 as soon as it is fixed

> It seems that Spec is still using the Morphic MenuMorph>>ToggleMenuItemMorph
> but it's not clear to me hoy to add this item.
> On the other hand, inspecting the ComposableModel class, it seem that in the
> future this will be done directly in Spec as suggested by the
> ComposableModel>>addMenuItemsToWindowMenu:

This method is to add custom menu entries to the window menu :)

Ben

> But so far that method simply says "do nothing".
> Any help?
> Thanks in advance
> Cheers
> Nacho
>
>
>
> --
> View this message in context: http://forum.world.st/Building-a-simple-UI-with-Spec-Problem-with-menus-tp4718881.html
> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
>
[1] https://pharo.fogbugz.com/default.asp?12051
Reply | Threaded
Open this post in threaded view
|

Re: Building a simple UI with Spec. Problem with menus.

Benjamin Van Ryseghem (Pharo)
In reply to this post by Ben Coman
On 03 Nov 2013, at 19:05, [hidden email] wrote:

nacho wrote:
Hi, this is my first post in the Pharo group.
I'm developing a simple Text Editor with some nice features as a way to
understand how Spec works. It seems that Spec will be the default UI
framework from Pharo 3 onwards, I know it's changing and evolving but I'll
take the risk.
The problem I'm facing is that I'm lost at trying to add a "Save as..."
option in the menu.
It seems that Spec is still using the Morphic MenuMorph>>ToggleMenuItemMorph
but it's not clear to me hoy to add this item.
On the other hand, inspecting the ComposableModel class, it seem that in the
future this will be done directly in Spec as suggested by the
ComposableModel>>addMenuItemsToWindowMenu:
But so far that method simply says "do nothing".
Any help?
Thanks in advance
Cheers
Nacho

 
Check ComposableModel subclass WindowModel.  I believe #addMenuItemsToWindowMenu: is just for the Window Menu (the small downward pointing arrow in the title bar) - so it doesn't apply to other ComposableModel subclasses like ListModel, etc.

cheers -ben

You believe right :)
It is indeed for the Window menu. 
But it applies to any ComposableModel is the sense that when added to a window, the menu entries will be added.

But yo were right in the sense that it does not apply to what I call basic widgets (like ListModel TextModel etc).

Ben
Reply | Threaded
Open this post in threaded view
|

Re: Building a simple UI with Spec. Problem with menus.

nacho
Thanks for your prompt responses. I guess the wise advise is...wait a little but I seldom follow the wise advice so I will continue to try to solve this ;)
I've been trying with ComposableModel>>#WindowModel with no luck as it seems that though the method is implemented in #WindowModel it seems to be inoperative.
cheers
Nacho

Nacho Smalltalker apprentice. Buenos Aires, Argentina.
Reply | Threaded
Open this post in threaded view
|

Re: Building a simple UI with Spec. Problem with menus.

Stéphane Ducasse
In reply to this post by nacho

> Hi, this is my first post in the Pharo group.

Welcome :)

> I'm developing a simple Text Editor with some nice features as a way to
> understand how Spec works. It seems that Spec will be the default UI
> framework from Pharo 3 onwards, I know it's changing and evolving but I'll
> take the risk.

Super!

> The problem I'm facing is that I'm lost at trying to add a "Save as..."
> option in the menu.
> It seems that Spec is still using the Morphic MenuMorph>>ToggleMenuItemMorph
> but it's not clear to me hoy to add this item.
> On the other hand, inspecting the ComposableModel class, it seem that in the
> future this will be done directly in Spec as suggested by the
> ComposableModel>>addMenuItemsToWindowMenu:
> But so far that method simply says "do nothing".
> Any help?
> Thanks in advance
> Cheers
> Nacho
>
>
>
> --
> View this message in context: http://forum.world.st/Building-a-simple-UI-with-Spec-Problem-with-menus-tp4718881.html
> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
>


Reply | Threaded
Open this post in threaded view
|

Re: Building a simple UI with Spec. Problem with menus.

Stéphane Ducasse
In reply to this post by Benjamin Van Ryseghem (Pharo)
Hi

I will integrate some fixes now.

Stef

> Hello and welcome :)
>
>
> On 03 Nov 2013, at 18:36, nacho <[hidden email]> wrote:
>
>> Hi, this is my first post in the Pharo group.
>> I'm developing a simple Text Editor with some nice features as a way to
>> understand how Spec works. It seems that Spec will be the default UI
>> framework from Pharo 3 onwards, I know it's changing and evolving but I'll
>> take the risk.
>
> Good to hear :) It is quite changing now, but should not change a lot starting from now (plus a couple of days
> waiting for the last changes to be integrated).
>
>> The problem I'm facing is that I'm lost at trying to add a "Save as..."
>> option in the menu.
>
> As far as I know, there is a bug in TextModel where the menu is hardcoded, and therefor can not be changed.
> In addition, as you have said, it is currently using directly Morphic menus that is bad.
>
> The issue 12051 [1] introduces Spec models for menus. The fix has yet to be integrated.
> So there are two solutions :)
> 1) You wait a bit tip this issue is integrated, and the TextModel problem solved (which should be done tonight)
> 2) You load locally the patches so you can try :)
> If you wanna do so you need to take the latest image and to merge the slices:
> - 11920 (this one will give you merge conflicts, you can safely take all the incoming versions)
> - 12051.
> - 11819 as soon as it is fixed
>
>> It seems that Spec is still using the Morphic MenuMorph>>ToggleMenuItemMorph
>> but it's not clear to me hoy to add this item.
>> On the other hand, inspecting the ComposableModel class, it seem that in the
>> future this will be done directly in Spec as suggested by the
>> ComposableModel>>addMenuItemsToWindowMenu:
>
> This method is to add custom menu entries to the window menu :)
>
> Ben
>
>> But so far that method simply says "do nothing".
>> Any help?
>> Thanks in advance
>> Cheers
>> Nacho
>>
>>
>>
>> --
>> View this message in context: http://forum.world.st/Building-a-simple-UI-with-Spec-Problem-with-menus-tp4718881.html
>> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
>>
> [1] https://pharo.fogbugz.com/default.asp?12051