background image
C H A P T E R 5
Stationery
5-14
Using Stationery
Using the MinimalBounds ViewDef Method
5
The
MinimalBounds
method must be used in a viewDef when the size of the
entry is dynamic, as it is in a paper-roll-style or page-style application. It's not
necessary for a card-style application, which has a fixed height; in that case you
should set a static height for your viewDef in the
viewDefHeight
slot.
The
MinimalBounds
method is used to compute the minimal size for the
enclosing bounding box for the viewDef at run time. The following is an
example of a
MinimalBounds
implementation where the viewDef contains
a
newtEditView
whose
path
slot is set to
[pathExpr:kDataSymbol,'notes]
:
MinimalBounds: func(entry)
begin
local result := {left: 0, top: 0, right: 0,
bottom: viewDefHeight};
// For an editView, make the bounds big enough to
// contain all the child views.
if entry.(kDataSymbol).notes then
foreach item in entry.(kDataSymbol).notes do
result := UnionRect( result, item.viewBounds );
result;
end;
© 2007-2024, o7 studio » при воспроизведении материала сайта ссылка обязательна