Skip navigation.
 
mlRe: NSTextView, style, and weird Core Data issue
FROM : I. Savant
DATE : Wed Jul 26 21:21:31 2006

Matt:

  My apologies if this seems a bit simplistic, but have you looked 
at -setTypingAttributes:? I would not expect the text view to "reset" 
them to some value just because the underlying text storage changed. 
You may need to manually reset the attributes when a new object is 
created / displayed.

  I think it may be displaying the typing attributes of a non-empty 
attributed string because those are the attributes at the current 
position.

  I may be entirely wrong, but this is just my guess. :-D

--
I.S.


On Jul 26, 2006, at 3:15 PM, Matt Neuburg wrote:

> 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_removed>, 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_removed>)
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/idiotsavant2005%
> 40gmail.com
>
> This email sent to <email_removed>

Related mailsAuthorDate
mlNSTextView, style, and weird Core Data issue Matt Neuburg Jul 26, 21:15
mlRe: NSTextView, style, and weird Core Data issue I. Savant Jul 26, 21:21
mlRe: NSTextView, style, and weird Core Data issue I. Savant Jul 26, 21:24
mlRe: NSTextView, style, and weird Core Data issue Matt Neuburg Jul 26, 22:22
mlRe: NSTextView, style, and weird Core Data issue I. Savant Jul 26, 22:34
mlRe: NSTextView, style, and weird Core Data issue I. Savant Jul 26, 22:42
mlRe: NSTextView, style, and weird Core Data issue Matt Neuburg Jul 27, 02:52
mlRe: NSTextView, style, and weird Core Data issue Martin Wierschin Jul 27, 09:27
mlRe: NSTextView, style, and weird Core Data issue Matt Neuburg Jul 27, 15:41
mlRe: NSTextView, style, and weird Core Data issue Matt Neuburg Jul 28, 01:30
mlRe: NSTextView, style, and weird Core Data issue Martin Jul 28, 02:04