Apple Newton Utilities User's Guide Page 128

  • Download
  • Add to my manuals
  • Print
  • Page
    / 942
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 127
CHAPTER 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 signicant 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 ll color, so you may be inclined to set the ll color to “none”
when you create such a view. However, it’s best to ll 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 lled with a solid color such as
white. However, don’t ll all views with white, since there is some small overhead
associated with lls; use this technique only if the view is one that is usually dirtied.
Redrawing Views 3
A view is agged 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 sufcient 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
signicantly 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
Page view 127
1 2 ... 123 124 125 126 127 128 129 130 131 132 133 ... 941 942

Comments to this Manuals

No comments