View System and Messages
Parent inheritance gives children access to slots in their ancestors--they can send messages to ancestors or access their data. Parents, on the other hand, can't easily access slots from or send messages to their children (also as in real life).
Of course, you can access a child from a parent by using the ChildViewFrames
message (this returns an array of children). But these children do not have names so it is difficult to send them messages. (It's as if the parents never named their children, referring only to them as the first child, the second child, and so on.)
Declaring a view to its ancestor provides a name for the child that can be used by that ancestor. Declaring a child view to an ancestor creates a slot in that ancestor whose value is the child view. Having done this, the ancestor can access slots from and send messages to the child using the child's name.
Open
message), the view system creates the view for the child and creates a slot in the parent to point to that child. The slot is set to nil
when the ancestor is closed, but as long as the ancestor is open, the declared view exists.
An online version of Programming for the Newton using Macintosh, 2nd ed. ©1996, 1994, Julie McKeehan and Neil Rhodes.
Last modified: 1 DEC 1996