background image
C H A P T E R 5
Stationery
5-6
Using Stationery
The dataDef component of your stationery should use a
FillNewEntry
method
to define its own discrete soup entry structure. Note that it is your responsibility to
set a
class
slot within each entry. The value of the
class
slot must match the
dataDef symbol and is used by the system when routing the entry (via faxing,
mailing, beaming, printing, and so on). An example of how to use
FillNewEntry
follows.
Using FillNewEntry
5
You use the
FillNewEntry
method in your dataDef to create an entry structure
that is tailored to your data. This approach is recommended when your stationery is
implemented as part of a NewtApp application.
The
FillNewEntry
method works in conjunction with the NewtApp
framework's
newtSoup.CreateBlankEntry
method. The
FillNewEntry
method takes a new entry, as returned by the
CreateBlankEntry
method, as a
parameter. This is done with a
CreateBlankEntry
implementation put in the
newtApplication.allSoups
slot of your NewtApp application, as shown in
the following example:
CreateBlankEntry: func()
begin
local newEntry := Clone({class:nil,
viewStationery: nil,
title: nil,
timeStamp: nil,
height: 176});
newEntry.title := ShortDate(time());
newEntry.timeStamp := time();
newEntry;
end;
This new entry contains an entry template. In the following code example, that
new entry is passed as a parameter to the
FillNewEntry
method, which is
implemented in the stationery's dataDef.
FillNewEntry
adds a slot named
kDataSymbol
, which contains an entry template for the stationery's data
definition. It then adds a
class
slot to the new entry, which is set to the same
constant (
kDataSymbol
). A
viewStationery
slot is then added and set to the
same constant (only needed for vestigial compatibility with the Notes application).
Finally, it adds a value to the
dueDate
slot of the
kDataSymbol
entry.
FillNewEntry: func(newEntry)
begin
newEntry.(kDataSymbol) :=
Clone({who: "A Name",
howMuch: 42,
dueDate: nil});
© 2007-2017, o7 studio » при воспроизведении материала сайта ссылка обязательна