I have an NSTextTable in which each cell will contain the entire text of a 
small RTF document. I want the user to be able to edit the document’s text in 
the cell, including applying styles.  

In this case, a “style" means an NSDictionary containing entries for 
NSFontAttributeName, NSParagraphStyleAttributeName, and some custom attributes 
that I need, but I think the layout manager will ignore.

When I go to apply a style to a paragraph, I call this method in my subclass of 
NSTextView:  

-(void)setParagraphStyle:(NSString*)styleName  
{
  Document* doc = [[self.window windowController] document];
  NamedStyle* sty = [doc.styleSet styleByName:styleName];

  [self.textStorage addAttributes:sty.attributes  
                            range:self.rangeForUserParagraphAttributeChange];

  [self didChangeText];  
}


Okay, I know that must be very wrong, because although doing it does alter the 
text as I expect, it also blows up my text table and breaks or merges cells.

What should I be doing instead, rather than blithely calling 
addAttributes:range:?

—

Charles Jenkins

_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to