home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / sys / mac / programm / 14383 next >
Encoding:
Internet Message Format  |  1992-08-23  |  1.6 KB

  1. Path: sparky!uunet!dtix!darwin.sura.net!wupost!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!ames!data.nas.nasa.gov!taligent!apple!minow
  2. From: minow@Apple.COM (Martin Minow)
  3. Newsgroups: comp.sys.mac.programmer
  4. Subject: Re: Scrolling (was:what remains when the clothes fly off?)
  5. Keywords: ScrollRect()
  6. Message-ID: <71519@apple.Apple.COM>
  7. Date: 22 Aug 92 16:02:50 GMT
  8. References: <171f6mINN2g1@darkstar.UCSC.EDU> <sold.74.714428884@kit.uni-kl.de>
  9. Organization: Apple Computer Inc., Cupertino, CA
  10. Lines: 29
  11.  
  12.  
  13. gil@cse.ucsc.edu asks about scrolling pictures (using ScrollRect). One of
  14. the arguments to ScrollRect is a region handle. It is set to a region that
  15. describes the area that was uncovered. Now, you can do the following:
  16.     ScrollRect(..., myInvalRgn);
  17.     InvalRgn(myInvalRgn);
  18. and your application will get an update event. Your update event handler
  19. should then redraw the entire window (only the "invalid" part will change).
  20. You can get somewhat better performance by doing the update stuff yourself:
  21.     ScrollRect(..., myInvalRgn);
  22.     InvalRgn(myInvalRgn);
  23.     BeginUpdate(myWindowPtr);
  24.     DrawMyWindow(myWindowPtr);
  25.     EndUpdate(myWindowPtr);
  26. This avoids the event-loop overhead. DrawMyWindow calls DrawControls,
  27. DrawGrowIcon, and then draws your application-specific content.
  28.  
  29. Another possibility is to save the current clip region, set the clip
  30. region to myInvalRgn, and just draw the content, but I suspect that
  31. the BeginUpdate...EndUpdate sequence is more robust.
  32.  
  33. Read through the description of regions in the QuickDraw chapter, and
  34. update event management in the Window Manager chapter -- both in Inside
  35. Mac volume 1.
  36.  
  37. Good luck.
  38.  
  39. Martin Minow
  40. minow@apple.com
  41.