Editing a NSTextFieldCell with attributed string
Editing a NSTextFieldCell with attributed string
- Subject: Editing a NSTextFieldCell with attributed string
- From: Dan Bernstein <email@hidden>
- Date: Wed, 5 Dec 2001 09:37:30 +0200
I have a NSTextFiledCell that I initialize with initTextCell:@"" and
then send it setAttributedStringValue: with an attributed string
containing different text colors for different ranges. When I send it
drawInteriorWithFrame:inView: it draws fine, including the colors.
However, later when I send it
editWithFrame:inView:editor:delegate:event:, the field editor displays
everything in black. As editor: I pass an NSTextView I create myself(*)
in my initialization method as follows: [[NSTextView alloc] init].
The question is, of course, what should I do in order to make the field
editor respect the string attributes.
(*) There's supposed to be a "shared field editor for all NSCells" but I
have no idea how to obtain it or whether I should use it. There's also a
shared window field editor supplied by NSWindow, but I don't think I
want to use that either. When I did, it behaved just like my private
NSTextView did.
TIA,
-- Dan Bernstein