StringMorph removing Text styling

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

StringMorph removing Text styling

Peter Uhnak
Hi,

I am not sure if this is a bug or a feature, but converting Text to StringMorph clears some of the formating.

Compare:

|text|
text := 'hello' asText makeAllColor: Color red.

text asStringMorph openInWindow. "no color"
(StringMorph contents: text) openInWindow. "with color"

Bug? Feature?

Thanks,
Peter
Reply | Threaded
Open this post in threaded view
|

Re: StringMorph removing Text styling

Pavel Krivanek-3
Personally I would expect that the second version should be fixed to discard formatting. We have the TextMorph for such cases.

-- Pavel

2017-10-18 11:40 GMT+02:00 Peter Uhnák <[hidden email]>:
Hi,

I am not sure if this is a bug or a feature, but converting Text to StringMorph clears some of the formating.

Compare:

|text|
text := 'hello' asText makeAllColor: Color red.

text asStringMorph openInWindow. "no color"
(StringMorph contents: text) openInWindow. "with color"

Bug? Feature?

Thanks,
Peter

Reply | Threaded
Open this post in threaded view
|

Re: StringMorph removing Text styling

Peter Uhnak
There's a cursor issue though... when you have TextMorphs in e.g. list (FastTable), then the cursor changes to text selection, that's why I wanted to use StringMorph.

So maybe renaming (subclassing?) StringMorph to LabelMorph to make it more clear?

Peter

On Wed, Oct 18, 2017 at 1:30 PM, Pavel Krivanek <[hidden email]> wrote:
Personally I would expect that the second version should be fixed to discard formatting. We have the TextMorph for such cases.

-- Pavel

2017-10-18 11:40 GMT+02:00 Peter Uhnák <[hidden email]>:
Hi,

I am not sure if this is a bug or a feature, but converting Text to StringMorph clears some of the formating.

Compare:

|text|
text := 'hello' asText makeAllColor: Color red.

text asStringMorph openInWindow. "no color"
(StringMorph contents: text) openInWindow. "with color"

Bug? Feature?

Thanks,
Peter


Reply | Threaded
Open this post in threaded view
|

Re: StringMorph removing Text styling

Peter Uhnak

So maybe renaming (subclassing?) StringMorph to LabelMorph to make it more clear?

Never mind. This apparently exists and I am blind...

Peter