Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!zaphod.mps.ohio-state.edu!uwm.edu!bionet!agate!ragu.berkeley.edu!lippin From: lippin@ragu.berkeley.edu (The Apathist) Newsgroups: comp.sys.mac.programmer Subject: Re: Drawstring Problem Message-ID: <1990Oct16.192709.29760@agate.berkeley.edu> Date: 16 Oct 90 19:27:09 GMT References: Sender: usenet@agate.berkeley.edu (USENET Administrator) Reply-To: lippin@math.berkeley.edu Organization: Authorized Service, Incorporated Lines: 33 Recently rg2c+@andrew.cmu.edu (Robert Nelson Gasch) wrote: >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? I suggest setting the text mode to srcCopy, which will cause the new text to cover up the text underneath. Since this won't erase all of the previous text if the new text is shorter, you can use something like this to erase to the end of the line: void cleartoeol(short eol) { FontInfo fi; Point pen; Rect r; GetFontInfo(&fi); GetPen(&pen); SetRect(&r,pen.h,pen.v-fi.ascent,eol,pen.v+fi.descent); EraseRect(&r); } I prefer this to doing an EraseRect of the whole text before drawing the new line, because this won't make the text flicker. --Tom Lippincott lippin@math.berkeley.edu "But let me repeat myself, at the risk of being clear: There must be fifty ways to write your program. Fifty ways to write your program."