Apple Newton Utilities Guía de usuario Pagina 905

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 942
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 904
Compile-Time Results A-1
APPENDIX
The Inside Story on Declare A
This appendix describes the technical details of the declare mechanism. Knowing
these technical details is not necessary to understanding what declaring a view
means; they are provided primarily for completeness and to help you when you are
debugging. You shouldn’t write code that depends on these details.
For a basic discussion of the declare mechanism, see the section “View Instantiation”
beginning on page 3-26. You should be familiar with that material before reading
this appendix.
To serve as an example here, imagine a calculator application whose base view is
named “Calculator.” It has (among others) a child view named “Display.” The
Display view is declared in the Calculator view. See Figure A-1 for an illustration
of this example.
In the following sections, we’ll explain what happens at compile time and at run
time as a result of the declare operation. A number of slots are created, which
you may see in the Newton Toolkit (NTK) Inspector if you are examining the
view templates.
Compile-Time Results 26
As a result of the declare operation, at compile time, NTK creates a slot in the place
where the view is declared—that is, in the Calculator template. The name of the slot
is the name of the declared view,
Display. This slot’s value is initially set to nil.
Another slot, called
stepAllocateContext, is also created in the Calculator
template. This slot holds an array of values (two for each view declared there). The
rst value in each pair is a symbol used by the system at run time to identify the
name of the slot in the Calculator view that holds a reference to the declared view.
This symbol is simply the name of the declared view,
Display.
The second value in each pair is a reference to the template for the declared view.
At run time, the system will preallocate a view memory object for the declared
view from this template.
Figure 27-0
Table 27-0
Vista de pagina 904
1 2 ... 900 901 902 903 904 905 906 907 908 909 910 ... 941 942

Comentarios a estos manuales

Sin comentarios