How Views Are Created

viewSetupFormScript()

The viewSetupFormScript message is sent before the viewCObject of a view is created. A number of the viewCObject's aspects are determined when it is created by slots in the view. Because of this, the viewSetupFormScript is the only place you can modify those slots and have the viewCObject notice. For instance, viewBounds, viewJustify, and viewFormat are some of the slots that the viewCObject reads from the view.

It follows that if you want to modify the values of those slots when the view is initialized, this is the place to do it. The viewSetupFormScript can override slots in the template. This ensures that the viewCObject reads the overridden slots rather than the template's slots. Here are some of the more typical aspects of a view that you use viewSetupFormScript to modify at run-time:


Caution:When you write a view method in a template, it may be overriding such a method in the proto. Make sure to call the old version of the method using:
inherited:?view...Script()
By using :? syntax (see "The :? Operator" on page 92), you'll take care of the case where there is such a method in the proto, as well as the case where there is not.


Setting Values in viewSetupFormScript
Changing Slots in viewBounds
Setting the Application Size at Run-time

An online version of Programming for the Newton using Macintosh, 2nd ed. ©1996, 1994, Julie McKeehan and Neil Rhodes.

Last modified: 1 DEC 1996