Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!cs.utexas.edu!helios!inetg1!news From: dedreb@arco.com (Richard Beecher) Newsgroups: comp.sys.mac.programmer Subject: Re: GrowWindow Woes, Help Please Message-ID: <1991Apr22.164037.17692@Arco.COM> Date: 22 Apr 91 16:40:37 GMT References: <9190.2810258e@jetson.uh.edu> Sender: news@Arco.COM Distribution: usa Organization: Arco Alaska Lines: 48 In article <9190.2810258e@jetson.uh.edu> englhq@jetson.uh.edu writes: >I'm working through the window techniques in Huxham, Burnard and Takatsuka's >USING THE MACINTOSH TOOLBOX WITH C, and I'm stuck at the GrowWindow function. >The code goes like this: > >case inGrow: > newSize=GrowWindow(whichWindow,theEvent.where,&limitRect); > SizeWindow(whichWindow, LoWord(newSize),HiWord(newSize),0xff); > contRgnHnd=theWindowRec.contRgn; > tempRect=(*contRgnHnd)->rgnBBox; > EraseRect(&tempRect); > DrawGrowIcon(theWindow); > break; > >What happens is, the outline of the scroll bars and size box remain in the >middle of the window. i.e. It seems that the EraseRect isn't doing what I >think it's supposed to. > Can't say that I know exactly what is happening here, but I wonder if a simpler approach would fix the problem. In the above code, you are referencing whichWindow, theWindowRec, and theWindow. How about trying the following code? case inGrow: newSize=GrowWindow(whichWindow,theEvent.where,&limitRect); EraseRect(&whichWindow->portRect); SizeWindow(whichWindow, LoWord(newSize),HiWord(newSize),0xff); DrawGrowIcon(whichWindow); break; Here, I only reference whichWindow. Also, for aesthetic reasons, I EraseRect before resizing the window. I think Apple also recommends this in the user interface guidelines (IM-1 section on Window Manager?). Erasing the window's portRect should accomplish the same thing as erasing its content region. Ah hah! I might be on to something hereQthe window's content region is expressed in global coordinates...its portRect is expressed in local coordinates. This might be the source of your problem. Essentially, you are erasing a rectangle that is outside your window's clipRgn. So if you want to stick with your original code, converting tempRect to local coordinates might fix your problem. Good luck! --------------- Richard Beecher dedreb@arco.com ---------------