Next, create a subclass of Object:
TextEditor has six public instance methods: cr (carriage return), display, nextPutAll:, open, openOn:, and show:. You can implement them in any order.
Public methods for the category Initialization & Startup
Method open
open
"Public - Creates and realizes the receiver."
self
createShell;
createWindow.
mainWindow
setAreas: menuBar
horizontalScrollbar: nil
verticalScrollbar: nil
workRegion: workRegion;
manageChild.
self realizeWindow.
Method openOn:
openOn: pathName
"Public - Opens the receiver on the text file specified by pathName."
self open.
self
fileName: pathName;
undo: nil clientData: nil callData: nil
Public methods for category File Operations
Method cr
cr "Public - Inserts a carriage return." self nextPutAll: (String with: Lf)
Method display
display "Public - Displays the shell." ^self shell display
Method nextPutAll:
nextPutAll: aString "Public - Appends the contents of aString to the receiver." | pos | text insert: (pos := text getLastPosition) value: aString; showPosition: pos + aString size. text updateWidget.
Method show:
show: aString "Public - Appends the contents of aString to the receiver." self nextPutAll: aString