Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!cs.utexas.edu!uunet!rosie!NeXT.COM From: Peter_King@NeXT.COM (Peter King) Newsgroups: comp.sys.next Subject: Re: View invalidation, scaling, [window display] vs. [view display] Message-ID: <839@rosie.NeXT.COM> Date: 29 May 91 01:18:55 GMT References: <1991May20.163623.10272@engage.pko.dec.com> Sender: news@NeXT.COM Lines: 47 Nntp-Posting-Host: palantir.next.com In article <1991May20.163623.10272@engage.pko.dec.com> tenny@ootool.dec.com (Dave Tenny) writes: > > When I scale the docview in response to hitting a "magnify" button, say: > > [docview scale :1.2 :1.2] ; > > then > > [docview display] ; > > the OLD contents of the docview are displayed, unscaled, as well as the > new, scaled contents. > > However, if I do a > > [window display] instead for the app's main window (which contains the > scrollview/docview), then everything works fine. However, this visibly > redraws the whole window, and is unpleasant to watch. > > What is the proper way to redraw the docview? > I have two answers to your one question. The best way to redraw a View that has invalidated what has already been drawn is to send it a "drawFromOpaqueAncestor:::" message. You can use this snippit of code: [myView displayFromOpaqueAncestor:(NXRect *)0 :0 :NO]; Each View keeps track of whether it is opaque or not (the default). To effectively erase parts of a View, its closest opaque ancestor needs to be redrawn. The best way to magnify something in a ScrollView is to scale:: its contentView rather than its docView. The contentView is almost always a member of the ClipView class. Check out the documentation. When you scale:: a ClipView, it will automatically redraw the docView *and* update the Scrollers to reflect the new size. Peter ----------Disclaimers? Always. Everything's Subjective---------- Peter F. King Developer Trainer NeXT Computer, Inc. USPS: 900 Chesapeake Dr. Redwood City, CA 94063 Internet: Peter_King@NeXT.COM