• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSDocument newbie
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
References: 
 >Re: NSDocument newbie (From: James Bucanek <email@hidden>)
 >Re: NSDocument newbie (From: John Stiles <email@hidden>)
 >Re: NSDocument newbie (From: Shaun Wexler <email@hidden>)

  • Prev by Date: Re: Setting vertical alignment for a NSTextFieldCell ?
  • Next by Date: problems with predicateWithFormat:
  • Previous by thread: Re: NSDocument newbie
  • Next by thread: NSTextView odd behaviour
  • Index(es):
    • Date
    • Thread