Spec question: how to set the About contents for the window opened with openWithSpec?

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

Spec question: how to set the About contents for the window opened with openWithSpec?

philippeback
In Pharo2.0 beta:

When doing an x openWithSpec, I do get a SystemWindow wrapping my widget.
That's all fine.

Now, I want the top right arrow "About" to give me back the text I
want. But currently, it answers the SystemWindow>>aboutText

aboutText
        "Answer the text to use for the About dialog."

        ^self model
                ifNil: ['This is a system window without a model' translated]
                ifNotNil: [self model class instanceSide organization classComment
                                        ifEmpty: ['The model of this window has no class comment']
                                        ifNotEmptyDo: [:comment | comment]]

This gives me the comment of the WindowModel as this is what Spec
creates for me during openWithSpec.

Ideas?

Phil

Reply | Threaded
Open this post in threaded view
|

Re: Spec question: how to set the About contents for the window opened with openWithSpec?

Sean P. DeNigris
Administrator
philippeback wrote
Ideas?
I created a hook. You can load the slice for Issue 7529: [ENH]: Spec "About" window text. Then override #aboutText in your ComposableModel subclass

Or, for now, this hack works, but I don't know if there are other consequences...
    MyCoolUI class>>open

        | instance windowModel |
        instance := self new.
        windowModel := instance openWithSpec.
        windowModel
                extent: 500@300.
        windowModel window model: instance.
        ^ windowModel.

And then you would write the about text in MyCoolUI class comment...

HTH,
Sean
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: Spec question: how to set the About contents for the window opened with openWithSpec?

philippeback
I am trying to load the slice from the PharoInbox in Monticello  but
it doesn't let me.

Clicking on the slice on the left pane gives me the list on the right,
which then goes back to the full list after like 2 seconds. That's
weird. Image 20522.

Typing 70529 in the right side search box lets me play.

But this is a strange behavior.

Thanks for the fix.

I saw that you removed the feature showing the class comment in the about box.
Maybe this is used by tools that do not use a model or something.

Phil

2013/2/18 Sean P. DeNigris <[hidden email]>:

> philippeback wrote
>> Ideas?
>
> I created a hook. You can load the slice for Issue 7529: [ENH]: Spec "About"
> window text. Then override #aboutText in your ComposableModel subclass
>
> Or, for now, this hack works, but I don't know if there are other
> consequences...
>     MyCoolUI class>>open
>
>         | instance windowModel |
>         instance := self new.
>         windowModel := instance openWithSpec.
>         windowModel
>                 extent: 500@300.
>         windowModel window model: instance.
>         ^ windowModel.
>
> And then you would write the about text in MyCoolUI class comment...
>
> HTH,
> Sean
>
>
>
> --
> View this message in context: http://forum.world.st/Spec-question-how-to-set-the-About-contents-for-the-window-opened-with-openWithSpec-tp4670435p4670459.html
> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Spec question: how to set the About contents for the window opened with openWithSpec?

philippeback
In reply to this post by Sean P. DeNigris
Well, there is still an issue to solve, namely that the about box has
now the right text (I added

>>aboutText
   ^self class comment

But then, the title of the about Window is wrong, as it says: "About
WindowModel"

(of course...)

Saw that Nautilus inherits from SystemWindow, so that's why it is
having the right title...

WindowModel>>title says:

title

        ^ self model
                ifNil: [ super title ]
                ifNotNil: [:m | m title ]

Well, some more digging needed...

Phil

2013/2/18 Sean P. DeNigris <[hidden email]>:

> philippeback wrote
>> Ideas?
>
> I created a hook. You can load the slice for Issue 7529: [ENH]: Spec "About"
> window text. Then override #aboutText in your ComposableModel subclass
>
> Or, for now, this hack works, but I don't know if there are other
> consequences...
>     MyCoolUI class>>open
>
>         | instance windowModel |
>         instance := self new.
>         windowModel := instance openWithSpec.
>         windowModel
>                 extent: 500@300.
>         windowModel window model: instance.
>         ^ windowModel.
>
> And then you would write the about text in MyCoolUI class comment...
>
> HTH,
> Sean
>
>
>
> --
> View this message in context: http://forum.world.st/Spec-question-how-to-set-the-About-contents-for-the-window-opened-with-openWithSpec-tp4670435p4670459.html
> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Spec question: how to set the About contents for the window opened with openWithSpec?

Sean P. DeNigris
Administrator
In reply to this post by philippeback
philippeback wrote
I saw that you removed the feature showing the class comment in the about box.
Maybe this is used by tools that do not use a model or something.
All original behavior is preserved. Only spec adds functionality, but defaults to the original behavior. See the added tests for more info...
Cheers,
Sean