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 (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 [EMAIL PROTECTED]

Reply via email to