Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!uupsi!sunic!kth.se!cyklop.nada.kth.se!news From: d88-jwa@byse.nada.kth.se (Jon W{tte) Newsgroups: comp.sys.mac.programmer Subject: Re: Question: scrolling in a window Message-ID: Date: 16 Mar 91 15:00:45 GMT References: <1991Mar14.021122.292@husc3.harvard.edu> <1991Mar15.032155.305@husc3.harvard.edu> Sender: news@nada.kth.se (Mr News) Organization: Royal Institute of Technology, Stockholm, Sweden Lines: 44 In-reply-to: reiss@husc9.harvard.edu's message of 15 Mar 91 08:21:54 GMT In article <> reiss@husc9.harvard.edu (Peter Reiss) writes: works, but does not look very good. I have noticed that most programs seem to scroll graphics by shifting the current picture in one direction and drawing in the extra area. How can I do this? ScrollRect() - it also accumulates a region in a RegionHandle which needs to be repainted. Like this: void ScrollUpDown ( int amount ) { RgnHandle saveClip , updateClip ; Rect r ; r = thePort -> portRect ; updateClip = NewRgn ( ) ; saveClip = NewRgn ( ) ; if ( ! saveClip ) { DoSysErr ( MemError ( ) ) ; } ScrollRect ( & r , 0 , amount , updateClip ) ; /* Update variables according to scroll */ GetClip ( saveClip ) ; SetClip ( updateClip ) ; DrawEverything ( ) ; SetClip ( saveClip ) ; DisposeRgn ( saveClip ) ; DisposeRgn ( updateClip ) ; } -- "The IM-IV file manager chapter documents zillions of calls, all of which seem to do almost the same thing and none of which seem to do what I want them to do." -- Juri Munkki in comp.sys.mac.programmer