FROM : Brad Oliver
DATE : Fri Jan 03 22:29:53 2003
On 12/20/02 11:59 AM, "Mike Ferris" <<email_removed>> wrote:
> I would start by overriding NSDocumentController's -openDocument: and
> -newDocument: to do nothing if you don't want a new document (and maybe
> -validateMenuItem: to not allow the menu choices to even be enabled
> when you can't handle them.
>
> That covers the menu commands. Pretty much all other means of opening
> a new document (double-clicking, AppleScript, etc...) will consult the
> app delegate if it implements -application:openFile:. So you can
> implement that. If you decide to allow the open, simply call
> NSDocumentController's --openDocumentWithContentsOfFile:display:,
> otherwise don't. And probably return YES either way since not opening
> a document in your case is not an error, but a "feature".
Just to follow up, this works perfect for my needs as described, with one
caveat. I needed to call back into NSDocumentController from my document
dealloc routine to finish the second half of the open/new process, otherwise
I got into a position where I had two documents present in the document
controller for a brief period, which confused some other code in my app.
Thanks all for the tips and advice!
--
Brad Oliver
<email_removed>
_______________________________________________
cocoa-dev mailing list | <email_removed>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
DATE : Fri Jan 03 22:29:53 2003
On 12/20/02 11:59 AM, "Mike Ferris" <<email_removed>> wrote:
> I would start by overriding NSDocumentController's -openDocument: and
> -newDocument: to do nothing if you don't want a new document (and maybe
> -validateMenuItem: to not allow the menu choices to even be enabled
> when you can't handle them.
>
> That covers the menu commands. Pretty much all other means of opening
> a new document (double-clicking, AppleScript, etc...) will consult the
> app delegate if it implements -application:openFile:. So you can
> implement that. If you decide to allow the open, simply call
> NSDocumentController's --openDocumentWithContentsOfFile:display:,
> otherwise don't. And probably return YES either way since not opening
> a document in your case is not an error, but a "feature".
Just to follow up, this works perfect for my needs as described, with one
caveat. I needed to call back into NSDocumentController from my document
dealloc routine to finish the second half of the open/new process, otherwise
I got into a position where I had two documents present in the document
controller for a brief period, which confused some other code in my app.
Thanks all for the tips and advice!
--
Brad Oliver
<email_removed>
_______________________________________________
cocoa-dev mailing list | <email_removed>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
| Related mails | Author | Date |
|---|---|---|
| Brad Oliver | Dec 16, 07:42 | |
| matt neuburg | Dec 17, 19:01 | |
| Brad Oliver | Dec 17, 22:58 | |
| matt neuburg | Dec 18, 18:49 | |
| Brad Oliver | Dec 18, 20:36 | |
| matt neuburg | Dec 19, 17:57 | |
| Brad Oliver | Dec 19, 19:18 | |
| Mike Ferris | Dec 20, 18:59 | |
| Brad Oliver | Jan 3, 22:29 |






Cocoa mail archive

