NSTextView, style, and weird Core Data issue
NSTextView, style, and weird Core Data issue
- Subject: NSTextView, style, and weird Core Data issue
- From: Matt Neuburg <email@hidden>
- Date: Wed, 26 Jul 2006 12:15:46 -0700
- Thread-topic: NSTextView, style, and weird Core Data issue
I'm having a weird problem where after displaying one entity, a new entity
displayed in the same NSTextView has the styling left over from the previous
entity.
Let me set the scene. This is an ultra-simple Core Data app, with a single
entity that has an NSData "facts" attribute. The NSTextView is bound to this
attribute in the usual way, by way of an NSArrayController, via its own
attributedString (using NSUnarchiveFromData).
So here's the deal. I type something into the NSTextView. Then I select all
(in the NSTextView) and type command-U, for Underline. Now all the text in
the NSTextView is underlined.
Now I press the New button, which is connected to the NSArrayController's
add: action. The NSTextView goes blank; it is displaying the new entity,
which is empty. I start typing, **and the typing is underlined**.
That's very bad. I want a new entity to have "plain" styling.
Okay, I'm open to suggestions! Let me tell you what I've done to work around
the problem, because this, too, is very weird. On my entity's
awakeFromInsert, I store the archived version of an NSAttributedString into
the "facts". If this attributed string has an empty string (@""), that
doesn't help! But if this attributed string has content - for example, a
space (@" ") - it solves the problem!!!
Unfortunately this solution is totally unacceptable, because I don't want
every new entity's "facts" starting out with a blank space as its content.
I'm wondering if anyone has any experience with this problem. Why is the
NSTextView retaining the styling from the previously displayed entity? Is
this a bug? m.
--
matt neuburg, phd = email@hidden, http://www.tidbits.com/matt/
pantes anthropoi tou eidenai oregontai phusei
AppleScript: the Definitive Guide - Second Edition!
http://www.amazon.com/gp/product/0596102119
Take Control of Word 2004, Tiger, and more -
http://www.takecontrolbooks.com/tiger-customizing.html
Subscribe to TidBITS! It's free and smart. http://www.tidbits.com/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden