Re: Loading PersistentDocuments into the same window
Re: Loading PersistentDocuments into the same window
- Subject: Re: Loading PersistentDocuments into the same window
- From: Brad Stone <email@hidden>
- Date: Fri, 30 Apr 2010 18:41:34 -0400
Quincey - you were right. The undo wasn't working because the windowController wasn't in the document's windowController array. I used your concept of reusing the same windowController and it works.
Thanks!
On Apr 30, 2010, at 4:12 PM, Quincey Morris wrote:
> On Apr 30, 2010, at 12:44, Brad Stone wrote:
>
>> [dc openDocumentWith...] is opening the new doc and it'll be associated with the same windowController in the makeWindowControllers method. I see how you're doing that. What I don't understand is the documentation for openDocumentWIthCOntentsOfURL doesn't mention anything about setting up the managedObjectContext or creating an undoManager and liking the MOC to a persistentStore. This could just be me because I've been doing cocoa for 6 months (programming in other languages for many years) but are you assuming all the stuff happens because openDocument... is called?
>
> It happens in the NSPersistentDocument initialization -- the NSDocumentController isn't involved beyond triggering the creation of the document.
>
>> Regarding the second part, yes I'm planning on setting up another windowController and when I show the second window moving the managedObjectContext over to it. Both windows will have the same moc. I had a similar problem with that: no undo and the saving didn't work but I put that on hold until I got the first part done. I figure if it works in the preview window making it work in it's own window should be straightforward.
>
> I believe that undo etc weren't working because your window controller wasn't in the document's windowControllers array.
>
> Note that if you're planning on allowing editing in both places, you have a whole other set of issues to do with, to keep the two views of the document contents in sync.
>
> I'm back to thinking this might be a bit misguided from the UI point of view. Presumably you have something in the preview window that lets you select which document to preview. Why not just leave that much in the preview window and just let that window open and close real document windows to do the "preview"? What's the payoff from integrating both into a single window (and is it big enough to justify the development time)?
>
>
> _______________________________________________
>
> 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
_______________________________________________
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