Adding a New Kind of Data to the Notepad

Create the viewDef

7. Create a new layout file and draw a clView. Make it a viewDef by adding three slots:

name
"Temperature Editor"

type
'editor

symbol
'default

8. Create and set its viewJustify to be parentRelativeTop vertically and parentRelativeFull horizontally and make its viewBounds {top: 0, left: 0, bottom: 64, right: 0}


Note:Remember that the slot layer protos can be used within stationery (isn't it wonderful that NewtApp and Stationery were designed in tandem!).


9. Draw two newtLabelNumInputLines as children of the clView.

We'll be storing data in a frame in the soup entry whose slot name is our dataDef symbol. Within that frame, we'll use slots named temperature and windSpeed. Let's set the slots of the first newtLabelNumInputLine so they will match:

label
"Temperature"

path
'|temp:Calliope|.temperature
Or, in order to take advantage of the kDataDefSym constant already defined, use:
[pathExpr: kDataDefSym, 'temperature]

Set the slots of the second newtLabelNumInputLine to:

label
"Wind speed"

path
'|temp:Calliope|.windSpeed
Or, in order to take advantage of the kDataDefSym constant already defined, use:
[pathExpr: kDataDefSym, 'windSpeed]

10. Save this layout as "TemperatureViewDefEditor.t" and add it to the project.


An online version of Programming for the Newton using Macintosh, 2nd ed. ©1996, 1994, Julie McKeehan and Neil Rhodes.

Last modified: 1 DEC 1996