






Hotspots: Admin Pages | Turn-in Site |
Current Links: Case Final Project Summer 2007
A Simple UI Example
"Edit this page and copy the contents (control-c here to copy and alt-v in squeak to paste) to a workspace in squeak. Then
select the text and use the yellow button to "file it in". Then do:
m := MyModel open.
m add: 'some text'.
m changed.
Notice that the model changes don't change the view until the changed message is sent.
"
Object subclass: #MyModel
instanceVariableNames: 'gobbledygook '
classVariableNames: ''
poolDictionaries: ''
category: 'simpleUI'!
MyModel methodsFor: 'as yet unclassified' stamp: 'mjg 9/20/2001 09:22'!
add: stuff
gobbledygook _ gobbledygook , stuff.! !
MyModel methodsFor: 'as yet unclassified' stamp: 'mjg 9/20/2001 09:16'!
changed
"Announce change to gobbledygook"
self changed: #myModelsText! !
MyModel methodsFor: 'as yet unclassified' stamp: 'mjg 9/20/2001 09:17'!
gobbledygook
^gobbledygook! !
MyModel methodsFor: 'as yet unclassified' stamp: 'mjg 9/20/2001 09:17'!
gobbledygook: stuff
gobbledygook _ stuff! !
MyModel methodsFor: 'as yet unclassified' stamp: 'mjg 9/20/2001 09:16'!
myModelsText
"Just return gobbledygook"
^gobbledygook! !
"– – – – – – – – – – – – – – – – – – "!
MyModel class
instanceVariableNames: ''!
MyModel class methodsFor: 'as yet unclassified' stamp: 'mjg 9/20/2001 09:22'!
new
|m|
m _ super new.
m gobbledygook: 'Here is some text.'.
^m! !
MyModel class methodsFor: 'as yet unclassified' stamp: 'mjg 9/20/2001 09:19'!
open
| m p |
m _ self new.
p _ PluggableTextMorph on: m text: #myModelsText accept: nil.
p openInWorld.
^m
!
Links to this Page