Making an Existing Application Stationery-Based

Create dataDef

2. Create a new layout file and draw a newtStationery within it.

Remove the viewBounds slot (since there will be no view associated with this dataDef). Set the remaining slots to:

symbol
kBookDataDefSym

superSymbol
kSuperSymbol

name
"Book"

description
"Book stationery"

version
1

StringExtract
func(e, nLines)
begin
local t := "";

// set the string t to a value
// based on slots
// from e, a soup entry
if e.acquireDate then
t := t &&
ShortDateStr(e.acquireDate,
kFormatDefault);
if e.numberInStock then
t := t &&
NumberStr(e.numberInStock);
return t := t && e.author &&
e.title;
end;

FillNewEntry
func(e)
begin
e.price := 15.95;
return e;
end

3. Save the layout file as "BookDataDef.t" and add it to your project. Change the build order so it builds before "Main.t".

4. Now it is time to modify the icon slot of the newtStationery, but before you can do that, you need to get an icon. Download the file containing the icon: Mac OS--a file with a named PICT resource, Windows--a bitmap file. Add this resource file to the project. Edit the icon slot to refer to that resource (see FIGURE 11.18).

FIGURE 11.18 : The icon slot of the dataDef.


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

Last modified: 1 DEC 1996