background image
C H A P T E R 3
Views
3-44
Using Views
To lay out a view containing a vertical column of child views, send the view the
message
LayoutColumn
.
Optimizing View Performance
3
Drawing, updating, scrolling, and performing other view operations can account
for a significant amount of time used during the execution of your application.
Here are some techniques that can help speed up the view performance of your
application.
Using Drawing Functions
3
Use the drawing functions to draw lines, rectangles, polygons, and even text in a
single view, rather than creating these objects as several separate specialized views.
This technique increases drawing performance and reduces the system overhead
used for each view you create. The drawing functions are described in "Drawing
and Graphics" (page 13-1)
View Fill
3
Many views need no fill color, so you may be inclined to set the fill color to "none"
when you create such a view. However, it's best to fill the view with white, if it
may be individually dirtied and 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; use this technique only if the view is one that is usually dirtied.
Redrawing Views
3
A view is flagged as dirty (needing redrawing) if you send it the
Dirty
message,
or as a result of some other operation, such as calling the
SetValue
function for a
view. All dirty views are redrawn the next time the system event loop executes.
Often this redrawing speed is sufficient since the system event loop usually
executes several times a second (unless a lengthy or slow method is executing).
However, sometimes you want to be able to redraw a view immediately. The fastest
way to update a single view immediately is to send it the
Dirty
message and then
call the global function
RefreshViews
. In most cases, only the view you dirtied
will be redrawn.
If you call
RefreshViews
and there are multiple dirty views, performance can be
significantly slower, depending on where the dirty views are on the screen and how
many other views are between them. In this case, what is redrawn is the rectangle
that is the union of all the dirty views (which might include many other nondirty
© 2007-1970, o7 studio » при воспроизведении материала сайта ссылка обязательна