background image
C H A P T E R 3
Views
About Views
3-21
IMPORTANT
Many views need no fill pattern, so you may be inclined to set the
fill pattern to "none" when you create such a view. However, it's
best to fill the view with white, if the view may be explicitly
dirtied (in need of redrawing) and if you don't need a transparent
view. This increases the performance of your application because
when the system is redrawing the screen, it doesn't have to update
views behind those filled with a solid color such as white.
However, don't fill all views with white, since there is some small
overhead associated with fills; only use this technique if the view
is one that is usually dirtied.
Also, note that the application base view always appears opaque,
as do all child views of the root view. That is, if no fill is set for
the application base view, it automatically appears to be filled
with white.
The view format attributes are listed and described in Table 2-5 (page 2-13) in the
Newton Programmer's Reference.
Custom Fill and Frame Patterns
3
Custom fill and custom view frame patterns are set for a view by using the
vfCustom
flag, as shown in Table 2-5 (page 2-13) in the Newton Programmer's
Reference, and by using following two slots:
viewFillPattern
Sets a custom fill pattern that is used to fill the view.
viewFramePattern
Sets a custom pattern that is used to draw the frame lines
around the view, if the view has a frame.
You can use custom fill and frame patterns by setting the value of the
viewFillPattern
and
viewFramePattern
slots to a binary data structure
containing a custom pattern. A pattern is simply an eight-byte binary data structure
with the class
'pattern
.
You can use this NewtonScript trick to create binary pattern data structures "on
the fly":
DefineGlobalConstant('myPat,SetLength(SetClass(Clone
("\uAAAAAAAAAAAAAAAA"),'pattern), 8));
This code clones a string, which is already a binary object, and changes its class to
'pattern
. The string is specified with hexadecimal character codes whose binary
representation is used to create the pattern. Each two-digit hex code creates one
byte of the pattern.
© 2007-2017, o7 studio » при воспроизведении материала сайта ссылка обязательна