a) Spec
~~~~~~~~~~~
tm := TextModel new.
tm autoAccept: true. "otherwise you would have to pres ctrl+s to 'save' the result in memory"
tm openWithSpec. "this will open text window
"and then you can do"
tm text. "retrieve current text from the TextModel (returns an instance of Text)"
tm text: 'new content' "set a new content"
~~~~~~~~~~
b) Workspace
~~~~~~~~~~~~~~~~~~~
w := Workspace new.
w open.
w contents. "note that you must ctrl+s the content in the workspace for it to appear here (there's a yellow triangle in top right corner if the content is not saved"
w contents: '123'.
~~~~~~~~~~~~~~~~~~
Workspace can also be saved/loaded to disk.
c) Playground
~~~~~~~~~~~~~~~~~~
(page := GTPlayPage new)
saveContent: 'initial content'.
(playground := GTPlayground new)
openOn: page.
page content. "retrieve the content; just like with Workspace you must ctrl+s when editing in the Playground itself"
"updating is a bit more complex, but it still seems to work"
page saveContent: 'new content'.
playground update.
~~~~~~~~~~~~~~~~~~~
Peter