Finishing the open method
Now add some code to setup the numeric display and the buttons area. Back in the Applications Browser, change the method to the final version shown below. Be sure to save the method once you type it in.
open
"Open a new instance of STCalculator."
| shell form |
shell := CwTopLevelShell
createApplicationShell: 'Calculator'
argBlock: nil.
form := shell
createForm: 'form'
argBlock: nil.
form manageChild.
self addDisplayTo: form.
self addButtonsTo: form.
shell realizeWidget.
Now you can see the design behind the window. You start with a CwTopLevelShell for the actual window. A CwForm is added to contain the display area and the buttons area. Note that we did not actually create the display and buttons areas; we simply put that problem off by calling two other methods (addDisplayTo: and addButtonsTo:, which have not yet been written). It is generally a good idea in Smalltalk to keep your methods as short and modular as possible.
Last modified date: 06/27/2019