
Newton Technology Journal June 1996
15
symbol slot in that
dataDef
. See the Newton Programmer’s Guide for
more information on the required slots for
dataDefs
. The
allDataDefs
frame can explicitly list a set of frames and/or it can reference NTK layouts
using the
GetLayout(filename)
function.
The allViewDefs Slot
The
allViewDefs
slot is where the
viewDefs
are linked to the
dataDefs
in your application. This includes any print or other routing
formats you wish to use. The structure of this frame parallels the
allDataDefs
slot. For each
dataDef
slot in
allDataDefs
you need a
frame which contains the
viewDefs
for that
dataDef
. Aside from the
stationery requirement that one of the
viewDefs
must be named default,
you are free to associate as many
viewDefs
with a single
dataDef
as you
like. For example, if an
allDataDefs
slot contains:
{ dataDef1: GetLayout(“dataDef1”),
dataDef2: GetLayout(“dataDef2”)},
then a matching
allViewDefs
slot might look like:
{ dataDef1:{default:GetLayout(“dd1DefaultViewDef”),
notes: GetLayout(“notesViewDef”),
frameFormat: protoFrameFormat},
dataDef2:{default: GetLayout(“dd2DefaultViewDef”),
frameFormat: protoFrameFormat}}
Note that for beaming and mailing, you can use the system-supplied
protoFrameFormat
which provides routing for free. Also, notice that
you don’t have to specify the same number of
viewDefs
for each
dataDef
. Even if the application is currently displaying an item with a
viewDef
, but that
viewDef
isn’t available for another item, the NewtApp
framework will switch to the default
viewDef
when needed. In addition,
the
newtShowStationeryButton
will only list the
viewDefs
available for the currently displayed item.
THE LAYOUT LEVEL
When we refer to layouts in NewtApp, we don’t mean layouts in the NTK
sense. Yes, the layouts in a NewtApp are NTK layout files, but so are the
other levels of a NewtApp. In NewtApp the layout layer controls the general
appearance of your application, so it may help to think of them as the “visual
layout” of the application. NewtApp supports two layouts in an application.
These are the layouts enumerated in the allLayouts slot of the application
layer, and are called default and overview. The default layout is used to show
the individual entries in your application soup, and the overview layout
provides the familiar Newton overview of your soup. Currently there are
three protos for the default layout, and two protos for the overview layout.
Which protos are used depends on the flavor of application you are building
– card, page or roll.
The most important slot to set in the layout proto is the
masterSoupSlot
. This slot contains the name of one of the slots from
the
allSoups
frame in the application base view. In the example from in
the
allSoups
section, the layouts would have a
masterSoupSlot
of
‘appSoup
. In addition, if you use the
statusBarSlot
mechanism of the
application base layer, then you can create
menuLeftButtons
and
menuRightButtons
at this level to replace the status bar buttons. Other
key slots and methods are outlined in the Newton Programmer’s Guide and
demonstrated in the DTS sample code. One handy method to remember is
DoRetarget()
. This method will update the layout from the soup data.
So, if you need to advance to a particular entry, you can go to the entry in
soup referenced by a layout’s
masterSoupSlot
and call
DoRetarget()
to update the views.
Kommentare zu diesen Handbüchern