Re: Creating temporary NSManagedObjects

2010-04-28 Thread Hal Mueller
On Apr 27, 2010, at 10:42 AM, vincent habchi wrote: > There is a simple reason: the objects in the Managed object context get > "represented" on a third window, whose contents are drawn from an Entity mode > NSArrayController that prepares its contents automatically. If I add my > temporary ob

Re: Creating temporary NSManagedObjects

2010-04-27 Thread Joanna Carter
Hi Vincent > There is a simple reason: the objects in the Managed object context get > "represented" on a third window, whose contents are drawn from an Entity mode > NSArrayController that prepares its contents automatically. If I add my > temporary object to the MOC, it automatically gets fet

Re: Creating temporary NSManagedObjects

2010-04-27 Thread vincent habchi
Quincey, > Notwithstanding the discussion in this thread so far, I don't quite > understand why you wouldn't do this the easy way: create a NSManagedObject in > your managed context, and delete it when you're done with it. > > The documentation explicitly describes the managed context as a "scr

Re: Creating temporary NSManagedObjects

2010-04-26 Thread Joanna Carter
Hi Quincey > Yes, I remember the discussion about this scenario: when the managed object > represents a *future* permanent resident of the Core Data object graph. > Outside of a discussion of that scenario, I wouldn't necessarily call this a > "temporary" object. > > In the OP's scenario, ther

Re: Creating temporary NSManagedObjects

2010-04-26 Thread Quincey Morris
On Apr 26, 2010, at 11:32, Joanna Carter wrote: > If you are editing a list of objects, using a NSTableView, then one reason > why you might not want to create temporary objects in the main context is > that those objects get displayed in the NSTableView, even though you might > not want them t

Re: Creating temporary NSManagedObjects

2010-04-26 Thread Joanna Carter
Hi Quincey > Notwithstanding the discussion in this thread so far, I don't quite > understand why you wouldn't do this the easy way: create a NSManagedObject in > your managed context, and delete it when you're done with it. If you are editing a list of objects, using a NSTableView, then one r

Re: Creating temporary NSManagedObjects

2010-04-26 Thread Quincey Morris
On Apr 26, 2010, at 01:43, vincent habchi wrote: > I need to create a short-lived NSManagedObject; ideally, I'd want it not to > be inserted in the Core Data underlying framework, because I need it only > during the display of an auxiliary window, and I don't want it saved anyway. > I've tried

Re: Creating temporary NSManagedObjects (PS)

2010-04-26 Thread vincent habchi
Le 26 avr. 2010 à 15:50, Jack Nutting a écrit : > Well I haven't actually tried it yet, so don't thank me yet! ;) The > docs for "initWithEntity:insertIntoManagedObjectContext :" do include > the text "If context is not nil, this method..." though, which seems > to imply that you should be able

Re: Creating temporary NSManagedObjects

2010-04-26 Thread Joanna Carter
Hi Vincent > nice, thanks a lot for talking some time explaining me this. De rien. > Your French is almost perfect, congratulations!; far superior to my own > English. I am glad my lack of skill in technical French didn't get in the way :-) Joanna -- Joanna Carter Carter Consulting

Re: Creating temporary NSManagedObjects (PS)

2010-04-26 Thread vincent habchi
Le 26 avr. 2010 à 15:50, Jack Nutting a écrit : > Well I haven't actually tried it yet, so don't thank me yet! ;) The > docs for "initWithEntity:insertIntoManagedObjectContext :" do include > the text "If context is not nil, this method..." though, which seems > to imply that you should be able

Re: Creating temporary NSManagedObjects

2010-04-26 Thread Joanna Carter
Hi Vincent > It would! :) No kidding, I really do not understand what is your dictionary > for. You don't have to tell me in French, I hope my English is sufficient, > but could you briefly explain me (in five lines or so) what your category is > supposed to do? La catégorie rajoute une méthod

Re: Creating temporary NSManagedObjects (PS)

2010-04-26 Thread Jack Nutting
On Mon, Apr 26, 2010 at 3:46 PM, Joanna Carter wrote: > Hi Jack > >> Right, but we were talking about passing in nil as the context when >> creating the object, so there's no context to remove it from. > > That's interesting. I have never tried using a nil context. Something more to > add to my k

Re: Creating temporary NSManagedObjects (PS)

2010-04-26 Thread Joanna Carter
Hi Jack > Right, but we were talking about passing in nil as the context when > creating the object, so there's no context to remove it from. That's interesting. I have never tried using a nil context. Something more to add to my knowledge repository :-) Thank you Joanna -- Joanna Carter Cart

Re: Creating temporary NSManagedObjects (PS)

2010-04-26 Thread Jack Nutting
Hi Joanna, On Mon, Apr 26, 2010 at 3:11 PM, Joanna Carter wrote: > >> Good question.  I believe a simple release/autorelease will do. > > If the object has been created by inserting into the context, then it would > have to be removed from the contrext. > > Joanna Right, but we were talking abo

Re: Creating temporary NSManagedObjects (PS)

2010-04-26 Thread Joanna Carter
Hi Jack > Good question. I believe a simple release/autorelease will do. If the object has been created by inserting into the context, then it would have to be removed from the contrext. Joanna -- Joanna Carter Carter Consulting ___ Cocoa-dev mail

Re: Creating temporary NSManagedObjects (PS)

2010-04-26 Thread Jack Nutting
On Mon, Apr 26, 2010 at 11:36 AM, vincent habchi wrote: > By the way, how do you delete these objects with a null MOC, since you are > supposed to call [MOC deleteObject:]? > Vincent Good question. I believe a simple release/autorelease will do. -- // jack // http://nuthole.com // http://lear

Re: Creating temporary NSManagedObjects

2010-04-26 Thread Joanna Carter
Hi Vincent > Yes. That NSObject holds some properties associated with a graphical layer. I > have a lot of them, that I classically save in order to be able to restore > the state of the application at launch. Now, to highlight a specific item on > a given layer, I create a temporary layer, tha

Re: Creating temporary NSManagedObjects

2010-04-26 Thread vincent habchi
Hi Joanna, > Do you really need an NSManagedObject? > Do you ever need to store instances of this particular class? Yes. That NSObject holds some properties associated with a graphical layer. I have a lot of them, that I classically save in order to be able to restore the state of the applicati

Re: Creating temporary NSManagedObjects

2010-04-26 Thread Joanna Carter
Hi Vincent > I need to create a short-lived NSManagedObject; ideally, I'd want it not to > be inserted in the Core Data underlying framework, because I need it only > during the display of an auxiliary window, and I don't want it saved anyway. > I've tried a simple alloc, an alloc and init, but

Re: Creating temporary NSManagedObjects (PS)

2010-04-26 Thread vincent habchi
Le 26 avr. 2010 à 11:04, Jack Nutting a écrit : > // assuming your app delegate contains the "managedObjectModel" method, which > // the standard Xcode-generated CoreData app typically does > NSManagedObjectModel *managedObjectModel = [[NSApplication delegate] > managedObjectModel]; > NSEntityDesc

Re: Creating temporary NSManagedObjects

2010-04-26 Thread vincent habchi
Jack, > What you want to do, probably, is create an object that doesn't belong > to a context (the context is what ends up saving your object to a data > store). You should be able to do something like this: > > // assuming your app delegate contains the "managedObjectModel" method, which > // t

Re: Creating temporary NSManagedObjects

2010-04-26 Thread Jack Nutting
On Mon, Apr 26, 2010 at 10:43 AM, vincent habchi wrote: > I need to create a short-lived NSManagedObject; ideally, I'd want it not to > be inserted in the Core Data underlying framework, because I need it only > during the display of an auxiliary window, and I don't want it saved anyway. > I've

Creating temporary NSManagedObjects

2010-04-26 Thread vincent habchi
Hi to all, I need to create a short-lived NSManagedObject; ideally, I'd want it not to be inserted in the Core Data underlying framework, because I need it only during the display of an auxiliary window, and I don't want it saved anyway. I've tried a simple alloc, an alloc and init, but to no a