On 30 Jan 2013, at 21:29, Gilles Celli <gilles.ce...@ecgs.lu> wrote:

> Well I think I found it: now the Open Panel disappears when opening large 
> files in my document-based app.
> Now the process of the data file is done in the subclassed NSWindowController 
> windowDidLoad method.
> 
> I've found something here on the Cocoa mailing list from 2002!:
> http://www.cocoabuilder.com/archive/cocoa/53353-grief-with-nsdocument-windowcontrollerdidloadnib.html
> 
> and this sentence was the most important:
> "If you do subclass NSWindowController you should instead override 
> NSWindowController's windowWillLoad and windowDidLoad methods."
> 
> Also here:
> https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/ApplicationKit/Classes/NSWindowController_Class/Reference/Reference.html
> 
> The fix to close the Open Panel immediately when the user clicked "Open" to 
> open small and large files:
> 
> 1. Read the content of the data file into NSString with NSDocument 
> readFromURL:ofType:error
> 2. NSDocument's makeWindowControllers creates a new windowController object 
> and I'm passing the data file
> 3. In the subclassed NSWindowController windowDidLoad / windowWillLoad method 
> the data file is processed before displayed as a graph.
> 
> This works now as expected, no more Open Panel staying open.
> Maybe I should even move the data processing to windowWillLoad, (tested it 
> and this works too).
> 
> My mistake was that I processed the data file inside readFromURL:ofType:error 
> and then makeWindowControllers passed the processed data file
> to the subclassed NSWindowController and everything was setup via 
> awakeFromNib.
> I didn't use NSWindowController's windowDidLoad or windowWillLoad method.

It sounds suspiciously like you've just papered over the problem to me. It 
sounds like you've gotten the open panel to go away, but now have a period of 
limbo where the app is unresponsive as it loads the window controllers and 
their windows.


_______________________________________________

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to