dataDef Slots

Optional Slots

version
Integer. An integer used for version control. You'll normally set this to 1.

description
String. A string that describes the type of data in a sentence.

icon
Bitmap. An icon used in the New menu.

FillNewEntry
func(e). A function called when a new soup entry is created. This function is called with e, a frame which has application-specific slots in it. You're responsible for adding any stationery-specific slots.
If you're creating stationery for an application with soups whose slots you don't control, you should store stationery-specific slots in a frame with your dataDef symbol. This way you avoid clashes with application slots.
FillNewEntry should return the filled-in frame. Here is an example:
func(e)
begin
e.(kDataDefSym).name := "Joe";
e.(kDataDefSym).age := 20;
return e;
end;

StringExtract
func(e, nLines). A function called to return a short textual description of e (for example, the text in the overview, the title in the In/Out box, or the text in the Find overview). nLines is the maximum number of lines of description to return. Here is an example:
func(e, nLines)
begin
local t := e.name;
if nLines>1 and e.age then
t := t && $\n &
NumberStr(e.age);
return t;
end;

TextScript
func(item, reserved). A function called to return the complete textual description of item.body (for example, the text for sending Mail). item is an item frame used by transports (see Newton Programmer's Guide: Communications for more details on item frames). reserved is a parameter which is currently undocumented. This function should return a string. Here's an example:
func(item, reserved)
begin
local e := item.body;
local t := "Name is" &&
e.name;
if e.age then
t := t &&"\nAge is "&&
NumberStr(e.age);
return t;
end;


Caution:Don't get confused by newtStationery and newtStationeryView. newtStationery is used as a proto for dataDefs while newtStationeryView is used as a placeholder for stationery within a newtEntryView.


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

Last modified: 1 DEC 1996