• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSTextView, style, and weird Core Data issue
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTextView, style, and weird Core Data issue


  • Subject: Re: NSTextView, style, and weird Core Data issue
  • From: "I. Savant" <email@hidden>
  • Date: Wed, 26 Jul 2006 15:21:31 -0400

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@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:
40gmail.com


This email sent to email@hidden

_______________________________________________ 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
  • Follow-Ups:
    • Re: NSTextView, style, and weird Core Data issue
      • From: Matt Neuburg <email@hidden>
    • Re: NSTextView, style, and weird Core Data issue
      • From: "I. Savant" <email@hidden>
References: 
 >NSTextView, style, and weird Core Data issue (From: Matt Neuburg <email@hidden>)

  • Prev by Date: Re: ODBC
  • Next by Date: Re: NSTextView, style, and weird Core Data issue
  • Previous by thread: NSTextView, style, and weird Core Data issue
  • Next by thread: Re: NSTextView, style, and weird Core Data issue
  • Index(es):
    • Date
    • Thread