Spec TextModel

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

Spec TextModel

Sven Van Caekenberghe-2
Hi,

I have a question about Spec's TextModel.
How do you use it without the assumption that it contains code ?
I just want to show real text and not have a code menu or active coding shortcuts.
It is probably me, but I can't find it.

Thx,

Sven
Reply | Threaded
Open this post in threaded view
|

Re: Spec TextModel

Peter Uhnak
Hi,

try this

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
TextModel new
isCodeCompletionAllowed: false;
menuHolder: [];
openWithSpec
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The second line disabled code completion, and the third disables right-click menu.

Disabling shortcuts may be a little more complex. From what I can tell the underlying morph (PluggableTextMorph) has the text stored in TextMorphForEditView, which has associated SmalltalkEditor.
For your needs you would need to change it to TextEditor, but I don't see any easy way how to change it.

If you will not be able to find a way, please open an issue (for Pharo5), because I think this should be possible.

Peter

On Fri, Mar 27, 2015 at 9:48 AM, Sven Van Caekenberghe <[hidden email]> wrote:
Hi,

I have a question about Spec's TextModel.
How do you use it without the assumption that it contains code ?
I just want to show real text and not have a code menu or active coding shortcuts.
It is probably me, but I can't find it.

Thx,

Sven

Reply | Threaded
Open this post in threaded view
|

Re: Spec TextModel

Sven Van Caekenberghe-2
Thanks, Peter.

This will help for now.

But my real point is indeed that the name is wrong.

Either TextModel should have configuration methods #beForCode and #beForText or there should be TextModel and a CodeModel (sub)class.

And from what you say, the plain variant is not even provided in Spec.

> On 27 Mar 2015, at 10:16, Peter Uhnák <[hidden email]> wrote:
>
> Hi,
>
> try this
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> TextModel new
> isCodeCompletionAllowed: false;
> menuHolder: [];
> openWithSpec
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> The second line disabled code completion, and the third disables right-click menu.
>
> Disabling shortcuts may be a little more complex. From what I can tell the underlying morph (PluggableTextMorph) has the text stored in TextMorphForEditView, which has associated SmalltalkEditor.
> For your needs you would need to change it to TextEditor, but I don't see any easy way how to change it.
>
> If you will not be able to find a way, please open an issue (for Pharo5), because I think this should be possible.
>
> Peter
>
> On Fri, Mar 27, 2015 at 9:48 AM, Sven Van Caekenberghe <[hidden email]> wrote:
> Hi,
>
> I have a question about Spec's TextModel.
> How do you use it without the assumption that it contains code ?
> I just want to show real text and not have a code menu or active coding shortcuts.
> It is probably me, but I can't find it.
>
> Thx,
>
> Sven
>


Reply | Threaded
Open this post in threaded view
|

Re: Spec TextModel

Peter Uhnak
Either TextModel should have configuration methods #beForCode and #beForText or there should be TextModel and a CodeModel (sub)class.

And from what you say, the plain variant is not even provided in Spec.
 
I agree, please open issue for it. 

Peter
Reply | Threaded
Open this post in threaded view
|

Re: Spec TextModel

Sven Van Caekenberghe-2

> On 27 Mar 2015, at 11:37, Peter Uhnák <[hidden email]> wrote:
>
> Either TextModel should have configuration methods #beForCode and #beForText or there should be TextModel and a CodeModel (sub)class.
>
> And from what you say, the plain variant is not even provided in Spec.
>  
> I agree, please open issue for it.
>
> Peter

https://pharo.fogbugz.com/f/cases/15237/Spec-TextModel-for-plain-text