beautypg.com

Application-defined methods 3, View instantiation 3 – Apple Newton Programmer’s Newton 2.0 (for Newton 2.0) User Manual

Page 110

background image

C H A P T E R 3

Views

3-26

About Views

IMPORTANT

Remember that the

viewChildren

and

stepChildren

arrays

contain templates, not views. If you try to send a message like

Hide

to one of the objects listed in this array, the system will

probably throw an exception because it is not a view.

During run time, if you want to obtain references to the child
views of a particular view, you must use the

ChildViewFrames

method. This method returns views from both the

viewChildren

and

stepChildren

slots. This method is

described in “Getting References to Views” (page 3-32).

Application-Defined Methods

3

As your application executes, it receives messages from the system that you can
choose to handle by providing methods that are named after the messages. These
messages give you a chance to perform your own processing as particular events
are occurring.

For example, with views, the system performs default initialization operations
when a view is instantiated. It also sends a view a

ViewSetupFormScript

message. If you provide a method to handle this message, you can perform your
own initialization operations in the method. However, handling system messages in
your application is optional.

The system usually performs its own actions to handle each event for which it
sends your view messages. Your system message-handling methods do not override
these system actions. You cannot change, delete, or substitute for the default system
event-handling actions. Your system message-handling methods augment the
system actions.

For example, when the view system receives a Show command for a view, it
displays the view. It also sends the view the

ViewShowScript

message. If you

have provided a

ViewShowScript

method, you can perform any special

processing that you need to do when the view is displayed.

The system sends messages to your application at specific times during its handling
of an event. Some messages are sent before the system does anything to respond to
the event, and some are sent after the system has already performed its actions. The
timing is explained in each of the message descriptions in “Application–Defined
Methods” (page 2-65) in the Newton Programmer’s Reference.

View Instantiation

3

View instantiation refers to the act of creating a view from its template. The process
of view instantiation includes several steps and it is important to understand when
and in what order the steps occur.