Re: NSDocument newbie
Re: NSDocument newbie
- Subject: Re: NSDocument newbie
- From: John Stiles <email@hidden>
- Date: Wed, 27 Jul 2005 11:37:53 -0700
On Jul 27, 2005, at 12:55 AM, Shaun Wexler wrote:
On Jul 26, 2005, at 6:27 PM, John Stiles wrote:
In fact, I did just that.
If it's already open with no windows open, I'd like to make a
click in the dock icon bring back the Open panel as well, but that
one stumped me. I tried having applicationShouldOpenUntitledFile:
do the following check:
if( [[[NSDocumentController sharedDocumentController] documents]
count] == 0 )
{
[[NSDocumentController] sharedDocumentController]
openDocument:self];
}
This almost worked. But if you clicked the dock icon, clicked the
desktop, and clicked the dock icon again, you'd get multiple open
panels simultaneously. Doh. So I just did openDocument in the
applicationDidFinishLaunching for now.
Try this:
NSOpenPanel *openPanel = [NSOpenPanel openPanel];
if ([openPanel isVisible]) {
[openPanel makeKeyAndOrderFront:self];
} else {
[openPanel runModalForDirectory:nil file:nil types:nil];
}
Since I didn't open the NSOpenPanel myself (NSDocument did it on my
behalf), is it really kosher to interact with it at all? Seems a
little dirty to me.
_______________________________________________
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