background image
C H A P T E R 3
Views
3-2
About Views
This section provides detailed conceptual information on views and other items
related to views. Specifically, it covers the following:
templates and views and how they relate to each other
the coordinate system used in placing views
components used to define views
application-defined methods that the system sends to views
the programmatic process used to create a view
new functions, methods, and messages added for 2.0 as well as modifications to
existing view code
Templates
3
A template is a frame containing a description of an object. (In this chapter the
objects referred to are views that can appear on the screen.) Templates contain data
descriptions of such items as fields for the user to write into, graphic objects,
buttons, and other interactive objects used to collect and display information.
Additionally, templates can include methods, which are functions that give the
view behavior.
Note
A template can also describe nongraphic objects like
communication objects. Such objects have no visual
representation and exist only as logical objects.
An application exists as a collection of templates, not just a single template. There
is a parent template that defines the application window and its most basic
features. From this parent template springs a hierarchical collection of child
templates, each defining a small piece of the larger whole. Each graphic object,
button, text field, and so on is defined by a separate template. Each child template
exists within the context of its parent template and inherits characteristics from its
parent template, though it can override these inherited characteristics.
Within the Newton object system, a template for a view exists as a special kind of
frame; that is, a frame containing or inheriting a particular group of slots
(
viewClass
,
viewBounds
,
viewFlags
, and some other optional slots) that
define the template's class, dimensions, appearance, and other characteristics.
Templates are no different from any other frames, except that they contain or
inherit these particular slots (in addition to others). For more information about
frames, slots, and the NewtonScript language, see The NewtonScript Programming
Language
.
© 2007-2024, o7 studio » при воспроизведении материала сайта ссылка обязательна