C H A P T E R 3
For a more detailed technical description of the inner workings of declaring a view,
see Appendix A, "The Inside Story on Declare."
Creating a View
A view is created in two stages. First, a view memory object (a frame) is created in
RAM. This view memory object contains a reference to its template, along with
other transient run-time information. In the following discussion, the phrase,
"creating the view" is used to describe just this part of the process. Second, the
graphic representation of the view is created and shown on the screen. In the
following discussion, the phrase, "showing the view" is used to describe just this
part of the process.
A view is created and shown at different times, depending on whether or not it is a
If the view is declared in another open (shown) view, it is created when the view
in which it is declared is sent the
message. For example, a child view
declared in the parent of its parent view is created when that "grandparent" view
is opened. Note, however, that the child view is not necessarily shown at the
same time it is created.
If the view is not declared in any view, it is created and also shown when its
immediate parent view is sent the
message. (Note that if a nondeclared
flag is not set, that view can never be created.)
Here is the view creation sequence for a typical application installed in the Newton
Extras Drawer and declared in the system root view:
1. When your application is installed on the Newton device, its base view is
automatically created, but not shown.
2. When the user taps on the icon representing your application in the Extras
Drawer, the system sends the
message to the
application's base view.
3. When the application is launched from the Extras Drawer, a view is created (but
not shown yet) for each template declared in the base view. Slots with the names
of these views are created in the base view. These slots contain references to
their corresponding views.
message is sent to the base view,
slots, and so
on, are read from the view template. The global bounds of the view are adjusted
to reflect the effects of the
, but the
are not changed, and the
message is sent to
the base view.