background image
C H A P T E R 3
Views
3-28
About Views
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
3
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
declared view.
If the view is declared in another open (shown) view, it is created when the view
in which it is declared is sent the
Open
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
Open
message. (Note that if a nondeclared
view's
vVisible
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
ButtonToggleScript
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.
4. The
ViewSetupFormScript
message is sent to the base view,
viewFlags
,
viewFormat
,
viewBounds
,
viewJustify
, and
declareSelf
slots, and so
on, are read from the view template. The global bounds of the view are adjusted
to reflect the effects of the
viewJustifyflags
, but the
viewBounds
values
are not changed, and the
ViewSetupChildrenScript
message is sent to
the base view.
© 2007-2017, o7 studio » при воспроизведении материала сайта ссылка обязательна