• 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
Re: Notification when NSPersistentDocument done loading model
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Notification when NSPersistentDocument done loading model


  • Subject: Re: Notification when NSPersistentDocument done loading model
  • From: Richard Ashwell <email@hidden>
  • Date: Tue, 30 Dec 2008 17:50:07 -0600

Wow that worked suprisingly well, Thank you Dave, so basically I added a flag and set it during initWithType:error: so I new the flag was happening during a New document creation rather than a load document, I then checked the flag in windowControllerDidLoadNib and for a new document I was able to send an additonal add: message to the controller so that a new document would already pre load.


On Dec 30, 2008, at 12:22 AM, Dave Fernandes wrote:


On Dec 28, 2008, at 7:31 PM, Richard Ashwell wrote:

If I understand Philip, I am having the same challenge, It isn't enough for me to let NSPersistentDocument do the load, I want a notification or some way of knowing after the load is completed so that I can fix up other related stuff. Is there someway to at a minimum:

1) In some overridden method of NSPersistentDocument subclass for my document as an example:

- (void)windowControllerDidLoadNib:(NSWindowController *)windowController

windowControllerDidLoadNib: would be a perfectly good place to do initialization after the document has been "loaded".



2) To test for when the nib loaded via the NSPersistentDocument's open event or was it instead via the new document event.


I am new to all of this please be gentle and Philip was here first, If I misread his question and mine is completely different?

Thanks in advance for any advice,

Richard


On Dec 22, 2008, at 5:58 PM, PHILIP GRANDINETTI wrote:

I'm using a Core Data model and letting NSPersistentDocument manage the task of finding and loading the application's model. My model contains data that I am displaying in a graph (SM2DGraphView) A problem I'm having is that once the model data is done loading I want to send a refresh message to the graph. So, I put the refresh message at the end of the document's initWithType:error: but this seems to be too early in the process and when the refresh asks the NSArrayController bound to the data, it says it is empty, that is, canRemove returns false.

initWithType:error: is only called for new documents, not for previously existing documents when re-opened.


initWithContentsOfURL:ofType:error: is called for existing documents, but the NSArrayController won't exist yet since the NIB has not yet been loaded.


I tried getting a notification with NSManagedObjectContextObjectsDidChangeNotification but this didn't seem to work. I can post the code in case this should have worked, but first I wanted to ask if there might be a simpler approach?


Thanks,

Philip

_______________________________________________

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


_______________________________________________

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


References: 
 >Notification when NSPersistentDocument done loading model (From: PHILIP GRANDINETTI <email@hidden>)
 >Re: Notification when NSPersistentDocument done loading model (From: Richard Ashwell <email@hidden>)
 >Re: Notification when NSPersistentDocument done loading model (From: Dave Fernandes <email@hidden>)

  • Prev by Date: Re: Input Method Kit Sample Code
  • Next by Date: Re: respondsToSelector - #import OR compiler warnings?
  • Previous by thread: Re: Notification when NSPersistentDocument done loading model
  • Next by thread: Arg, lmao question - (int)getters/setters.
  • Index(es):
    • Date
    • Thread