background image
C H A P T E R 5
Stationery
Using Stationery
5-11
Here is an example:
TextScript: func(item,target)
begin
item.text := "IOU " & target.(kDataSymbol).who
&& "owes me" &&
NumberStr(target.(kDataSymbol).howMuch);
item.text;
end;
Creating ViewDefs
5
ViewDefs may be based on any of the generic view protos. You could use, for
instance, a
clView
, which has very little functionality. Or, if you wanted a picture
to display behind your data, you could base your viewDef on a
clPictureView
.
Routing and printing formats are also implemented as viewDefs. You can learn
more about using special protos to create routing and printing formats in Chapter 21,
"Routing Interface."
Note that these are just a few examples of views you may use as a base view in
your viewDef. Your viewDef will function as expected, so long as the required slots
are set and the resulting view template is registered, either in the
allviewDefs
slot of the
newtApplication
base view or through the
InstallScript
function of an auto part.
You may create the viewDef for the auto part that extends the Notes application by
using a
clView
as the base view. Create an NTK view template, named
iouDefaultViewDef
, in which a
clView
fills the entire drawing area. Then
save the view template file (using the Save As menu item) as
iouDefaultViewDef
.
You can now set the slots as follows:
Set the
name
slot to
"IOU Info"
. This string appears in the Show button, if
there is one.
Set the
symbol
slot to
'default
. At least one of the viewDefs associated with
a dataDef must have
'default
as the value of its
symbol
slot.
Set the
type
slot to
'viewer
. The three system-defined types for viewDefs are
'editor
,
'viewer
, and
'routeFormat
. You may define others as you wish.
Set the
viewDefHeight
slot to 176 (of the four slot views that will be added
to this viewDef, each is 34 pixels high plus an 8-pixel separation between them
and an 8-pixel border at the bottom).
Set the
viewBounds
slot to 0, 0, 0, 0.
Set the
viewJustify
slot to horizontal parent full relative and vertical parent
full relative.
© 2007-2024, o7 studio » при воспроизведении материала сайта ссылка обязательна