Squeak
  links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
TextStream
Last updated at 4:11 am UTC on 11 May 2017
The following example shows how to use class TextStream.
It was posted to the Squeak list by Boris Gaertner on 5-Jan-2003.

TextStreamsExample1.png

  | ts |
  ts := TextStream on: (Text new: 100).
  ts nextPutAll: 'Class ';
     withAttribute: TextEmphasis bold
          do: [ts nextPutAll: 'TextStream'];
          cr.
  ts nextPutAll: 'This class is used to create ';
     withAttributes: (Set with: TextEmphasis bold with: TextEmphasis underlined)
          do: [ts nextPutAll: 'styled text.'];
          cr;
     withAttribute: TextEmphasis italic
          do: [ts nextPutAll: 'Styled text'];
     withAttribute: TextEmphasis normal
          do: [ts nextPutAll: ' has display properties like '];
     withAttribute: TextEmphasis bold
          do: [ts nextPutAll: 'bold '];
     withAttribute: TextEmphasis italic
          do: [ts nextPutAll: 'italic '];
     withAttribute: TextEmphasis struckOut
          do: [ts nextPutAll: 'struck out '];
     cr.

 (Workspace new contents: ts contents)
         openLabel: 'TextStreams are powerful'



How to create a text with different font sizes

How to create a hyperlink in a Text

A third example