• 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: Suggesting an initial filename with document-based app?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Suggesting an initial filename with document-based app?


  • Subject: Re: Suggesting an initial filename with document-based app?
  • From: Eric Wang <email@hidden>
  • Date: Thu, 03 Jul 2003 03:57:19 -0400

on 7/2/03 6:19 PM, Matt Gemmell at email@hidden wrote:

> Hi there,
>
> I have a document-based application, and I'd like to suggest a filename
> when the user first saves a document. I believe I can detect if it's the
> first time a document has been saved by checking if the document's
> window's representedFilename is the empty string (right?), but I'm
> unsure how to actually cause the Save panel to show my suggested
> filename.
>
> NSDocument's -saveDocumentWithDelegate:... gets called before the panel
> is run, and I see no way to specify a filename there, and
> -saveToFile:... is run after the user has chosen a name/location in the
> panel, and I obviously don't want to override their choice.
> -prepareSavePanel gives me access only to the save panel object itself,
> which offers no way to set an initial title before running it. None of
> the NSSavePanel delegate methods allow me to specify an initial
> filename.
>
> What part of the NSDocument saving machinery do I need to override in
> order to suggest an initial filename (say, based on the document's
> contents)? Or is there more involved in order to achieve this?
>
> Cheers,
> -Matt


Hi Matt,

Here's one way that might work:

- (BOOL) prepareSavePanel: (NSSavePanel *) savePanel
{
if ([self fileName] == nil)
{
NSForm *form = [[savePanel contentView] viewWithTag:
NSFileHandlingPanelForm];

// Here you can customize the form however you want
}

return YES;
}

Eric Wang
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: [OT] Re: EOF undead?
  • Next by Date: Authorization with NSTask
  • Previous by thread: Re: Suggesting an initial filename with document-based app?
  • Next by thread: Re: Suggesting an initial filename with document-based app?
  • Index(es):
    • Date
    • Thread