beautypg.com

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

Page 151

background image

C H A P T E R 4

NewtApp Applications

Using NewtApp

4-13

responsibility for its operation is 100% yours. If you are going to redistribute it,
you must make it clear in your source files that the code descended from
Apple-provided sample code and you have made changes.

The sample is an application for gathering data that supports the system services
routing, filing, and finding. It presents two views of the data to be collected: a
required default view; “IOU Info” (and an alternate “IOU Notes” view); and a
required overview. IOU Info and IOU Notes are stationery and appear as items in
the Show button’s picker. In addition, it shows how to implement the application in
the three styles of NewtApp applications: card, page, and roll. See the DTS sample
code for details.

The application starts with three basic NTK layout files:

The application base view—a

newtApplication

proto.

A default layout—one of the layout protos.

An overview layout—either the

newtOverLayout

or

newtRollOverLayout

proto.

The application also contains the NTK layout files for the stationery, a dataDef,
and its two corresponding viewDefs:

iouDataDef

iouDefaultViewDef

iouNotesViewDef

The creation of these files is shown in Chapter 5, “Stationery.”

A NewtApp application must include standard

InstallScript

and

RemoveScript

functions. Any icons must be included with a resource file; the

example uses

CardStarter.rsrc

. In the example, there is also a text file,

Definitions.f

, in which application globals are defined. Neither the resource

file nor the text file is required.

The basic view slots,

viewBounds

,

viewFlags

, and

viewJustify

,

are discussed in Chapter 3, “Views,” and are called out in the samples only
when there is something unusual about them.

Using Application Globals

4

These samples use several application globals. When you use NTK as your
development system, they are defined in a definitions file, which we named

Definitions.f

.

The values of the constants

kSuperSymbol

and

kDataSymbol

are set to the

application symbol. They are used to set slots that must have unique identifying
symbols. You are not required to use the application symbol for this purpose, but it
is a good idea, because the application symbol is known to be unique.