NSDocument Deferred loading
NSDocument Deferred loading
- Subject: NSDocument Deferred loading
- From: Eyal Redler <email@hidden>
- Date: Tue, 09 Mar 2004 11:43:07 +0200
Hi All,
While reading a document from a file I would like to be able to
present, sometimes, a dialog box asking for user decision (for example,
a "Font Matching" dialog).
When the dialog is presented the use is also given the option to cancel
the file load.
The most simple approach is to get this done during
loadDataRepresentation: and returning NO when the user cancels but I've
discovered that while this works fine for double-click/drag and drop
file opens, if the use cancels after invoking the document opening via
"Open Recent" I'm getting an additional error message (since I've
returned "NO" from loadDataRepresentation:).
This gave me the idea of deferring the reading to some other time,
basically:
1. Retain the NSData object in loadDataRepresentation and return YES
2. Parse the document at some later time (However, this must be before
the document window is displayed)
3. Close the document if the dialog was displayed and the user pressed
"Cancel"
This brings me to my questions:
a. Where should I put the parsing/dialog code? (I'm think about doing
it in showWindows:)
b. What's the best way to close the document immediately? (I thought
about [self release] but I'm worried this could cause problems if the
showWindows caller tries to call any method after that)
Thanks!
Eyal Redler
------------------------------------------------------------------------
------------------------
"If Uri Geller bends spoons with divine powers, then he's doing it the
hard way."
--James Randi
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.