Creating and Using User Protos
viewBounds
to a protoStaticText
template).
For user protos, however, NTK is necessarily a bit brain-dead. When you create a template that protos from a user proto, it has only one slot in it: the _proto
slot. NTK does not add any other slots. This difference is quite important.
Let's take the example of the viewBounds
slot to help illustrate the point. NTK adds a viewBounds
slot to many templates protoing from system protos, for example, a protoStaticText. Based on what it knows about protoStaticText, NTK assumes (quite reasonably) that you want each protoStaticText template to have a different location and size (see FIGURE 7.7).
FIGURE 7.7 : Four protoStaticText
templates and their default slots.
viewBounds
slot to templates protoing from protoStatus. NTK makes the assumption (again, quite reasonably) that you will only have one protoStatus inside a particular parent view at any one time. NTK thus creates protoStatus templates that directly inherit the viewBounds
slot from protoStatus. Each template benefits in that its location is ideally placed relative to its parent. It also means, however, that each consecutive protoStatus template has the same size and screen location. Since each inherits the same viewBounds
, each is drawn right on top of the last one (see FIGURE 7.8).
FIGURE 7.8 : Four protoStatus
templates and their default slots.
An online version of Programming for the Newton using Macintosh, 2nd ed. ©1996, 1994, Julie McKeehan and Neil Rhodes.
Last modified: 1 DEC 1996