background image
C H A P T E R 3
About Views
Contains a reference to the parent template. This slot is
created when the view opens. Note that it's best to use the
function to access the parent view at run time, rather
than directly referencing the
Contains an array that holds references to each of the
template's child templates. This slot is created and set
automatically when you graphically create child views in
NTK. This slot is for children that you add to a template.
Contains an array that holds references to each of a system
proto's child templates. Because this slot is used by system
protos, you should never modify it or create a new one with
this name. If you do so, you may be inadvertently overriding
the children of a system proto. An exception to this rule
occurs for clEditView; you might want to edit the
viewChildren slot of a clEditView. See Table 2-1, "View
class constants," (page 2-2) in Newton Programmer's Guide
for details.
The reason for the dual child view slots is that the
slot is used by
the system protos to store their child templates. If you create a view derived from
one of the system protos and change the
slot (for example, to add
your own child templates programmatically), you would actually be creating a new
slot that would override the one in the proto, and the child
templates of the proto would be ignored.
slot has been provided instead as a place for you to put your
child templates, if you need to do so from within a method. By adding your
templates to this slot, the
slot of the proto is not overridden. Both
groups of child views are created when the parent view is instantiated.
If you are only creating views graphically using the Newton Toolkit palette, you don't
need to worry about these internal details. The Newton Toolkit always uses the
slot for you.
You may see either
, or both slots when you
examine a template at run time in the Newton Toolkit Inspector window. Child
templates can be listed in either slot, or both. When a view is instantiated, all the
child views from both of these two slots are also created. Note that the templates in
slot are instantiated first, followed by the templates in the
If you are adding child views in a method that will not be executed until run time,
you need to use the
slot to do this. If there isn't a
slot, create one and put your views there.
© 2007-2017, o7 studio » при воспроизведении материала сайта ссылка обязательна