[Q][Documentation][TextStream]
Hannes Hirzel
hannes.hirzel.squeaklist at bluewin.ch
Sat Apr 20 19:26:26 UTC 2002
Hi
I'm trying to write a class comment for 3.2g for the class TextStream.
The following is my first attempt. What do you think?
Actually the interface TextStream has seems to me a bit clumsy?
There is only one user of TextStream.
Regards
Hannes
Begin of class comment
----------------------------------------------------------------------
A TextStream is used to write a stream of Text.
"You create a new instance with for example:"
stream _ TextStream on: (Text new: 200).
"This stream can be used just like other streams which are only for
strings
but here we create Text:"
stream nextPutAll: 'Hello '.
"You can write out a string and give it a text attribute:"
stream withAttribute: TextColor red do: [ stream nextPutAll: 'world!'].
stream withAttribute: TextEmphasis bold do: [ stream nextPutAll: 'How
are you '].
"You can give several text attributes at once:"
stream withAttributes: (Array with: TextEmphasis italic with: TextColor
blue) do: [ stream nextPutAll: 'doing!'].
"To see the result evaluate:"
(TextMorph new contents: stream contents) openInWorld
------------------------------------------------------------------------
----------------------
End of class comment
More information about the Squeak-dev
mailing list
|