• 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: Shaun Wexler <email@hidden>
  • Date: Wed, 27 Jul 2005 00:55:38 -0700

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];
    }

HTH~
--
Shaun Wexler
MacFOH
http://www.macfoh.com


_______________________________________________ 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
  • Follow-Ups:
    • Re: NSDocument newbie
      • From: John Stiles <email@hidden>
References: 
 >Re: NSDocument newbie (From: James Bucanek <email@hidden>)
 >Re: NSDocument newbie (From: John Stiles <email@hidden>)

  • Prev by Date: Window Closing Behavior
  • Next by Date: Re: Performance issue : NSDictionary against NSXMLNode and NSXMLParser
  • Previous by thread: Re: NSDocument newbie
  • Next by thread: Re: NSDocument newbie
  • Index(es):
    • Date
    • Thread