[Q][Morphic][presentation] Highlighting a text
Hannes Hirzel
hirzel at spw.unizh.ch
Fri Mar 8 18:32:25 UTC 2002
Hi
Is there another possibility of highlighting a TextMorph (i.e. changing
it's background color for example to yellow) than just wrapping it in
another Morph? I'd like to have that certain TextMorphs in a composite
Morph are highlighted depending on some user or script action.
Instead of having a TextMorph for every single character like in
the hello word example I posted some hours ago I will have a
composite morph where each word is in a single TextMorph.
p := PasteUpMorph new.
p color: Color blue twiceLighter twiceLighter twiceLighter.
p position: 10 at 10.
p extent: 170 at 100.
p openInWorld.
p layoutPolicy: TableLayout new. "lay out contents as a table"
p listDirection: #leftToRight. "how we want to place the contents"
p listCentering: #topLeft. "start list at the top"
p wrapDirection: #topToBottom.
p wrapCentering: #topLeft.
p cellInset: 4.
"p changeDragAndDrop."
('Hello world! How are you doing?' findTokens: ' ') do: [ :word |
wordTM := TextMorph new.
wordTM beAllFont: ((TextStyle default fontOfSize: 36) emphasized: 1).
wordTM contentsAsIs: word asString.
wordTM color: Color random.
p addMorphBack: wordTM].
Hannes Hirzel
More information about the Squeak-dev
mailing list
|