beautypg.com

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

Page 195

background image

C H A P T E R 5

Stationery

Using Stationery

5-13

Set the slots of the

newtLabelNumInputLine

as follows:

Set the

label

slot to

"How Much"

.

Set the

path

slot to

[pathExpr: kDataSymbol, 'howMuch]

. This

path

slot must evaluate to a slot in your data entry frame that contains a number (or a
place to store one).

Add a

newtLabelDateInputLine

at the top of the

default

template so that it

is aligned as shown. Then set the slots as follows:

Set the

label

slot to

"Date Due"

.

Set the

path

slot to

[pathExpr: kDataSymbol, 'dueDate]

. This

path

slot must evaluate to a slot in your data entry frame that contains a date (or a
place to store one).

Add a

newtLabelTimeInputLine

at the top of the

default

template so that it

is aligned as shown. Then set the slots as follows:

Set the

label

slot to

"Due Time"

.

Set the

path

slot to

[pathExpr: kDataSymbol, 'dueDate]

. This

path

must evaluate to a slot in your data entry frame that contains a time (or a place
to store one).

Registering Stationery for an Auto Part

5

When your stationery is implemented in an auto part, you are responsible for
registering and removing it. The following code samples show

InstallScript

and

RemoveScript

functions that use the appropriate global functions to register

and unregister the viewDef and dataDef files in your auto part as it is installed and
removed, respectively. Note that the print format file is also registered as a viewDef
with the system.

InstallScript: func(partFrame,removeFrame)

begin

RegDataDef(kDataSymbol, GetLayout("iouDataDef"));

RegisterViewDef(GetLayout("iouDefaultViewDef"),

kDataSymbol);

RegisterViewDef(GetLayout("iouPrintFormat"),

kDataSymbol);

end;

RemoveScript: func(removeFrame)

begin

UnRegisterViewDef('default, kDataSymbol);

UnRegisterViewDef('iouPrintFormat, kDataSymbol);

UnRegDataDef(kDataSymbol);

end;