tenny@ootool.dec.com (Dave Tenny) (05/20/91)
Perhaps someone can answer the following question. I have a view which I am drawing in using PSxxxx functions. It is the docview of a scrollview. 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 tried all kinds of things including displaying various superviews, setting notify flags, etc.. Only displaying the window caused the desired display of the docview. Dave
Peter_King@NeXT.COM (Peter King) (05/29/91)
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