Re: Opening a document in the same window
Re: Opening a document in the same window
- Subject: Re: Opening a document in the same window
- From: Mike Abdullah <email@hidden>
- Date: Thu, 12 Jan 2006 01:56:52 +0000
I would subclass NSDocumentController. Apple has a rather neat
document on the web with lots of info about NSDocument etc. that will
tell you how best to do it:
http://developer.apple.com/documentation/Cocoa/Conceptual/Documents/
Tasks/FAQ.html
Then I would simply override openDocumentWithContentsOfFile:display:
so that it:
1. Runs a check to see if you have a blank document open
2. If yes, then send that instance of NSDocument the command to open
your document
3. If no, then call openDocumentWithContentsOfFile:display: of super
I agree with you that this seems a better way of doing things that
the default, and intend to incorporate in my own apps (if I ever do a
normal doc-based app!).
Mike.
On 11 Jan 2006, at 17:55, Theodore H. Smith wrote:
How do I get a document to open in a specified window?
Apple's TextEdit.app does exactly this.
When you open TextEdit, there is an empty window.
If you open a .txt document from the finder, that window gets used
as the file editor!
So TextEdit was able to use an existing specified window, instead
of opening a new one.
I'd like to be able to do the same. Any ideas anyone?
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40gmail.com
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden