C H A P T E R 1 9
Built-in Applications and System Data
Names
19-5
Here is an example of an
infoFrame
for a Names viewDef defining a view that
has two fields,
Make
and
Model
:
infoFrame:{checkPaths: '[carMake, carModel],
checkPrefix: '[true, [pathExpr: carInfo]],
stringData: nil,
format: "^?0Make: ^0
||^?1Model: ^1||" }
When chosen from the Add picker the first time, this view initially fills in the
carMake
and
carModel
slots in the soup entry with the user's entries. If chosen
again, this view creates an array called
carInfo
containing one frame for each
additional data set. These frames would look like this:
{carMake:
make
, carModel:
model
}
The reason this is necessary is that after information for the first car is entered, the
soup entry will contain the slots
carMake
and
carModel
. The information for the
second car could not also be stored in the
carMake
and
carModel
slots of the
soup entry. Instead a
carInfo
slot is added to the soup entry, this slot holds a
frame containing
carMake
and
carModel
slots.
When a view from the Add picker is instantiated, the system creates a slot called
selectedPath
in the view that was instantiated. This slot is set to the path
expression where data should be entered (or to
nil
if the data should be entered
directly into the soup entry). For example, when chosen from the Add picker the
first time, the view in this example would have its
selectedPath
slot set to
nil
,
meaning that the information should be put directly into the soup entry. When
chosen from the picker the second time, the
selectedPath
slot is set to
[pathExpr: carInfo, 0]
, to indicate that the new car information should go
into the first frame in the
carInfo
array. The third time,
selectedPath
is set to
[pathExpr: carInfo, 1]
, and so on.
Adding a New Card Layout Style
19
When the "Card" layout is selected in the Show picker, the Names application
looks at the
cardType
slot of the current card to determine which kind of business
card layout to use for that card. You can create new viewDefs and register them
with the Names application to use a custom card layouts. Card viewDefs must have
the
type
slot set to
'bizcard
, and must contain a
bizCardNum
slot and a
bizCardIcon
slot.
The
bizCardNum
slot contains an integer that corresponds to the value stored in
the
cardType
slot of the card entries. The values 0-6 correspond to the business
card layouts that are built into the system. You should pick integers over 1,000 to
use as a
bizCardNum
, and register your number with Newton DTS.