Apple Newton Programmer’s Newton 2.0 (for Newton 2.0) User Manual

Page 113

Advertising
background image

C H A P T E R 3

Views

About Views

3-29

5. The

viewChildren

and

stepChildren

slots are read and the child views

are instantiated using this same process. As part of the process, the following
messages are sent to each child view, in this order:

ViewSetupFormScript

,

ViewSetupChildrenScript

, and

ViewSetupDoneScript

.

6. The

ViewSetupDoneScript

message is sent to the view.

7. The view is displayed if its

vVisible viewFlags

bit is set.

8. The

ViewShowScript

message is sent to the view and then the

ViewDrawScript

message is sent to the view. (Note that the

ViewShowScript

message is not sent to any child views, however.)

9. Each of the child views is drawn, in hierarchical order, and the

ViewDrawScript

message is sent to each of these views, immediately

after it is drawn.

As you can see from step 5, when a view is opened, all child views in the hierarchy
under it are also shown (as long as they are flagged as visible). A nonvisible child
view can be subsequently shown by sending it the

Open

message—as long as it

has been declared.

Closing a View

3

When you send a view the

Close

message, the graphic representation of the view

(and of all of its child views) is destroyed, but the view memory object is not
necessarily destroyed. There are two possibilities:

If the view was declared, and the view in which it was declared is still open, the
frame is preserved. You can send the view another

Open

or

Toggle

message to

reopen it at a later time.

A view memory object is finally destroyed when the view in which it was
declared is closed. That is, when a view is closed, all views declared in it are
made available for garbage collection.

If the view being closed was not declared, both its graphic representation and its
view memory object are made available for garbage collection when it is closed.

When a view is closed, the following steps occur:

1. If the view is closing because it was directly sent the

Close

or

Toggle

message, the system sends it the

ViewHideScript

message. (If the view

is closing because it is a child of a view being closed directly, the

ViewHideScript

message is not sent to it.)

2. The graphic representation of the view is removed from the screen.

3. The view is sent the

ViewQuitScript

message.

The view itself may or may not be marked for garbage collection, depending on
whether or not it was declared.

Advertising