
Adding a New Kind of Data to the Notepad

FIGURE 11.10 : Creating a new Temperature form and resizing in the Notes application.
1. First, let's modify the description slot to say:
"Temperature (Neil Rhodes)"And a
version slot:
12. Now, add a
StringExtract slot that will provide the text for the overview:
func(e, nLines) begin local t := ""; if e.(kDataDefSym).temperature then t := t & "Temp:" && NumberStr(e.(kDataDefSym).temperature); if e.(kDataDefSym).windSpeed then t := t & " Wind:" && NumberStr(e.(kDataDefSym).windSpeed); return t; end;3. Finally, we'll add a
FillNewEntry method to fill in default values:
func(e) begin e.(kDataDefSym).temperature := 40; e.(kDataDefSym).windSpeed := 11; return e; end;
When you remove a package that contains a viewDef, make sure that viewDef isn't in use. This would happen if you are displaying a piece of stationery in the Notepad and then download a new version. Your only recourse after doing so is to reset the Newton. (You'll find this is something you often remember just after you start to download your stationery--by then it is too late.)RemoveScript: GetRoot().paperroll:Close()

FIGURE 11.11 : Overview displaying result of dataDef's StringExtract.

FIGURE 11.12 : Information slip after tapping on Temperature icon.
An online version of Programming for the Newton using Macintosh, 2nd ed. ©1996, 1994, Julie McKeehan and Neil Rhodes.
Last modified: 1 DEC 1996