Path: utzoo!mnetor!uunet!husc6!bloom-beacon!mit-eddie!ll-xn!ames!pasteur!agate!web8g.berkeley.edu!laba-5as From: laba-5as@web8g.berkeley.edu (Bob Heiney) Newsgroups: comp.sys.mac.programmer Subject: TESetStyle bug Message-ID: <9416@agate.BERKELEY.EDU> Date: 29 Apr 88 20:37:13 GMT Sender: usenet@agate.BERKELEY.EDU Reply-To: laba-5as@widow.berkeley.edu (Bob Heiney) Organization: University of California, Berkeley Lines: 54 Keywords: TextEdit I think I've found a bug in TESetStyle. If it has already been found and is in a technote, excuse me for posting. My application does the following when the user chooses a text face option (bold, shadow, etc.) from my hierarchical text face menu: 1. Get the current selection/insertion point style. 2. If the option is plain text, then set the current face to [], and go to step 4. 3. Look and see if the face option is checked or not checked in the menu. 3. If it is checked, set the new face to be the current face - [option], otherwise set the new face to be the current face + [option]. 4. Call TESetStyle(doFace,...) with the modified style record. Here's what happens: Adding options to the current face always works. If there is only one face option selected and the user says to unselect it, then it works just like you'd expect. The new style is the old one except that it is no longer bold, shadowed, or whatever it was before. No matter how many face options are selected, plain text always works. If, however, there is more than one face option (e.g. [bold,italic]), and I try to set the new face (e.g. to [bold,italic]-[italic]) then TESetStyle does not work. It leaves the options unchanged. The work-around to this bug is to call TESetStyle(doFace,...) with a style whose face is plain text ([]). Then Call TESetStyle(doFace,...) with a style that includes the new face. This bug is not in my code, to the best of my knowledge, because of the behavior mentioned in the work-around. If my code were at fault and I were getting the wrong style or something then the work-around wouldn't work either. Sorry if I was a little redundant above, but I wanted the bug and its circumstances to be very clear. I have a Mac Plus and am running System Release 5.0 (System 4.2, Finder 6.0, Multifinder). Anyone from Apple have any comments? -------------------------------------------------------------------------- Bob Heiney laba-5as@widow.berkeley.edu