Making your own applications : Practice: Creating DevelopTextEditor and DevelopTimeLogger : Example: Creating DevelopTextEditor : Defining the class TextEditor

Defining the class TextEditor
Next, create a subclass of Object:
1.
From the Classes menu, select Add > Subclass.
2.
3.
In the next prompter, select subclass; then select OK.
4.
a.
Add the instance variables mainWindow menuBar workRegion shell text fileName modified popup.
b.
Add the pool dictionaries CfsConstants CldtConstants CgConstants CwConstants.
5.
Implementing the public instance methods
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.