Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!julius.cs.uiuc.edu!apple!stevec From: stevec@Apple.COM (Steve Christensen) Newsgroups: comp.sys.mac.programmer Subject: Re: Drawstring Problem Message-ID: <10727@goofy.Apple.COM> Date: 16 Oct 90 16:59:08 GMT References: Organization: Apple Computer Inc., Cupertino, CA Lines: 34 rg2c+@andrew.cmu.edu (Robert Nelson Gasch) writes: >I'm using graphics and the Drawstring function. I need to use Drawstring >since I have to display status lines that get updated. The problem is, >once you have put something in your window with Drawstring, it is >like you glued it to the window. You can't write over it since that will just >put the new string over the old one and you end up with something >completeley unledgible. What is the most sensible way to erase strings >in this situation? The method should be flexible as the size of the >text displaying area is subject to frequent change. >If anybody has done something like this and solved this problem in a >sensible manner, please let me know the details of how you went about >it. The perfect thing would be to just write over the old string. I've >tried this, but could not get it to work. There are a few ways of doing this depending on how you want the display to look. You can use TextBox() and specify a bounding rectangle big enough to hold the string you'd display. You'd call StringWidth() to find out how wide the string is and then build a rectangle that wide. The down side to this is that whatever's behind the string gets erased each time. Another way to do this is to draw the string in XOR mode and then draw it again (to erase it) just before updating the display. This way is better if something's drawn "behind" the string... steve -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ whoami? Steve Christensen snail: Apple Computer, 20525 Mariani Ave, MS-81CS, Cupertino, CA 95014 Internet: stevec@goofy.apple.com AppleLink: stevec CompuServe: 76174,1712