Skip navigation.
 
mlRe: CoreData and Bindings - a single, simple entity with bindings
FROM : Marcus Roberts
DATE : Sun May 01 11:30:12 2005

Earlier I wrote:


> When I run the application created, the document window appears, with
> two empty fields, but the document data is marked as needing to be
> saved, as the red window close button has the dark dot in the middle.
> If I type into each text field, then press Apple-Z to undo, the two
> fields clear in turn, and then they become disabled with "No
> Selection" written in them.


I think I understand now - asking something aloud always seems to set
the right though processes in action :-)

I started the application again, and this time the document object is
instantiating an entity object in its constructor, using:

person = [NSEntityDescription
           insertNewObjectForEntityForName:@"Person"
            inManagedObjectContext:[self managedObjectContext]];

and I bind the view to this using the NSObjectController's
ContentObject binding.

This solves the No Selection problem - I of course need to instantiate
an object in the document to bind to (this is done by the
arraycontroller in the multiple entity version).

I guess the document is marked as needing saving because I've
instantiated an object in the managed context.  What's the proper way
of handling this? I don't want the document to need saving until the
user modifies a value in the document.

Thanks

Marcus

Related mailsAuthorDate
mlCoreData and Bindings - a single, simple entity with bindings Marcus Roberts May 1, 10:59
mlRe: CoreData and Bindings - a single, simple entity with bindings Marcus Roberts May 1, 11:30
mlRe: CoreData and Bindings - a single, simple entity with bindings mmalcolm crawford May 2, 08:37
mlRe: CoreData and Bindings - a single, simple entity with bindings Tom Birch May 2, 08:40