background image
A P P E N D I X
Run-Time Results
A-3
Figure A-1
Declare example
Calculator
Display
Display
{
preallocatedContext:
'Display
.
.
}
Calculator
As a result of the declare, two
slots are added to the Calculator
template. The
Display
slot will
eventually hold the address of the
Display view.
In the Calculator view, the
address of the newly created
Display view is stored in the
slot whose name matches the
first entry in the
stepAllocateContext
array in the Calculator
template.
Also as a result of the declare,
one slot is added to the Display
template. It holds the name of the
slot in the Calculator template
where its view address will be
stored.
Later, when the Display view is to
be shown, the system finds the
preallocated view by using the
preallocatedContext
slot
(in the template) and looking for a
slot with that name in the Calculator
view. That slot holds the address of
the preallocated Display view.
Templates
(compile time)
Views
(run time)
{
_proto:
Display: Display
.
.
}
{
Display:
nil
stepAllocateContext:
['Display, Display]
.
.}
When the
Calculator view
is opened, this
Display view is
preallocated.
{
_proto:
.
.
}
© 2007-2024, o7 studio » при воспроизведении материала сайта ссылка обязательна