beautypg.com

Apple Newton Programmer’s Newton 2.0 (for Newton 2.0) User Manual

Page 159

background image

C H A P T E R 4

NewtApp Applications

Using NewtApp

4-21

frame containing slots with references to all the viewDef layout templates that
work with that dataDef.

The recommended way to name the corresponding

allDataDefs

and

allViewDefs

slots is to set the slot names to the data symbol constant,

as shown in the following code examples.

Set the

allDataDefs

slot to return a frame with references to all the application’s

dataDefs, as follows:

result := {};

result.(kDataSymbol) := GetLayout("IOUDataDef");

// result.(kData2Symbol) := ... to add a 2nd DataDef

result;

Set the

allViewDefs

slot to return a frame with references to all the application’s

viewDefs, in a parallel manner, as shown in the following code:

result := {};

result.(kDataSymbol) := {

default: GetLayout("IOUDefaultViewDef"),

notes:

GetLayout("IOUNotesViewDef"),

iouPrintFormat: GetLayout("IOUPrintFormat"),

// Use for routing (beaming, mailing, transports):

frameFormat: {_proto: protoFrameFormat},

};

// Use to add a 2nd DataDef:

// result.(kData2Symbol) := {...}

result;

A NewtApp application only accepts stationery when a dataDef has a

superSymbol

with a value matching the value of the

newtApplication

base view’s

superSymbol

slot. For this reason you want the value of the

superSymbol

slot to be a unique symbol. This sample application uses

the constant

kSuperSymbol

, which is set to the application symbol

'|IOU:PIEDTS|

, to set the

superSymbol

slot.

Using the Required NewtApp Install and Remove Scripts

4

An

InstallScript

function and

RemoveScript

function are required to

register your NewtApp application with the system for the various system services.
These scripts are boilerplate functions you should copy unaltered.