• 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
CoreData NSTextView changes: not noticed with KVO, not accessible from program, but stored anyway
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CoreData NSTextView changes: not noticed with KVO, not accessible from program, but stored anyway


  • Subject: CoreData NSTextView changes: not noticed with KVO, not accessible from program, but stored anyway
  • From: Theo Vosse <email@hidden>
  • Date: Wed, 2 Apr 2008 19:12:02 +0200

Hi,

I have an NSTextField that has a "data" binding to an NSObjectController, configured for an Entity, in a CoreData app (freshly created in XCode under Tiger).

When I edit the text field and save the file, all changes are stored. But when I try to get the contents in my program, I only get the first object read. Changes made after that are simply not visible, nor are they passed on to observeValueForKeypath.

The code looks like this:

In the NSDocument derived class:

	IBOutlet NSObjectController* grammarController;

which is connected to an object controller in the nib file, configured for the entity GrammarTextObject, which has only one interesting member, text, of the type NSData. There is also an NSTextField in the nib which has data bound to the object controller's selection.text;

Then I try:

GrammarTextObject* grammarObject = [grammarController selection]; // also tried: content
NSData* grammarText = [grammarObject valueForKey:@"text"];
NSAttributedString* attrText = [[[NSAttributedString alloc] initWithRTF:grammarText documentAttributes:nil] autorelease];


but all I get is the text read from the file, not the text that is visible in the text field. Also, attempts to get a notification upon change don't work:

[[grammarController selection] addObserver:self forKeyPath:@"text" options:0 context:0]

Does anyone have a clue? Thanks in advance,

	Theo Vosse
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
This email sent to email@hidden


  • Prev by Date: Ordering all day events via CalCalendarStore API
  • Next by Date: Re: Bindings for NSComboBox?
  • Previous by thread: Ordering all day events via CalCalendarStore API
  • Next by thread: Can't add new file extension to app's document types
  • Index(es):
    • Date
    • Thread