On 2009 Jun 21, at 07:37, Donnie Lee wrote:
I created NSTableView and bind table column with NSTextFieldCell with custom NSValueTransformer subclass to NSArrayController. My value transformer should return NSAttributedString transformed from NSString. Everything works fine except that the table shows NSString instead of NSAttributedString. It looks like: "My text{NSFont = "LucidaGrande....}". How to make the right behavior for my value transformer?
I've never seen an NSTextFieldCell bound to an attributed string. I don't believe that NSTextFieldCell supports attributed strings. If you bind it to a value that provides an attributed string, it probably extracts the string and ignores the attributes, giving the result you see.
As far as I know, an NSTextFieldCell must have the same font for its entire string. To set the font, subclass -[NSTableColumn dataCellForRow:] so that you can provide the cell. An instance of NSTextFieldCell will be fine. In that implementation, send that cell a setFont: message before you return it.
If you really want to have a different font in different attribute runs, you'll need to subclass that NSTextFieldCell.
Well, at least someone will probably notice your message now and correct me if I'm wrong :)
_______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com