
CHAPTER 3
Views
3-8 About Views
As the grid lines are infinitely thin, so a point is infinitely small. Pixels, by contrast,
lie between the lines of the coordinate grid, not at their intersections.
This relationship gives them a definite physical extent, so that they can be seen on
the screen.
Defining View Characteristics 3
A template that describes a view is stored as a frame that has slots for view
characteristics. Here is a NewtonScript example of a template that describes a view:
{viewClass: clView,
viewBounds: RelBounds( 20, 50, 94, 142 ),
viewFlags: vNoFlags,
viewFormat:vfFillWhite+vfFrameBlack+vfPen(1),
viewJustify: vjCenterH,
viewFont: simpleFont10,
declareSelf: 'base,
debug: "dialer",
};
Briefly, the syntax for defining a frame is:
{slotName: slotValue,
slotName: slotValue,
...};
where slotName is the name of a slot, and slotValue is the value of a slot. For more
details on NewtonScript syntax, refer to The NewtonScript Programming Language.
Frames serving as view templates have slots that define the following kinds of view
characteristics:
Class The
viewClass slot defines the class of graphic object from
which the view is constructed.
Behavior The
viewFlags slot defines other primary view behaviors
and controls recognition behavior.
Location, size, and alignment
The
viewBounds and viewJustify slots define the
location, size, and alignment of the view and its contents.
Appearance The
viewFormat slot defines the frame and fill
characteristics. The
viewFillPattern and
viewFramePattern slots control custom patterns.
Transfer modes used in drawing the view are controlled
by the
viewTransferMode slot.
Komentarze do niniejszej Instrukcji