C H A P T E R 4
NewtApp Applications
4-16
Using NewtApp
Use code similar to the following example to set the
allSoups
slot:
allSoups:=
{ IOUSoup: {_proto: newtSoup,
soupName: "IOU:PIEDTS",
soupIndices: [
{structure: 'slot,
path: 'title,
type: 'string},
{structure: 'slot,
path: 'timeStamp,
type: 'int},
{ structure: 'slot,
path: 'labels,
type: 'tags }
],
soupQuery: {type: 'index, indexPath:
'timeStamp},
soupDescr: "The IOU soup.",
defaultDataType: '|BasicCard:sig|,}
}
Using the Layout Protos
4
Each NewtApp Application requires exactly two layouts: a default layout,
displayed when the application is opened, and an overview layout, displayed when
the Overview button is tapped.
The NewtApp framework layout proto you choose for your default view, sets up
your application as either a card-, roll-, or page-style application.
Unique slots in the layout protos include:
masterSoupSlot
forceNewEntry
The
masterSoupSlot
is the most important. It contains a reference to the
application soup in the
newtApplication.allSoups
slot, from which the
layout gets its data.
The
forceNewEntry
slot allows your application to deal gracefully with
the situation created when someone opens a folder that is empty. If the
forceNewEntry
slot is set to
true
in that situation, an entry is automatically
created. Otherwise, an alert slip announces that there are no items in this list,