• 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: Setting initial filename for Save As
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Setting initial filename for Save As


  • Subject: Re: Setting initial filename for Save As
  • From: Robert Martin <email@hidden>
  • Date: Tue, 13 Dec 2005 13:03:49 -0500

If you like living dangerously, there's a simple way to do this by using a category. I can't recommend it since it goes around NSSavePanel's API - and could break on the next OS update. However, it works for me...

Basically, if you look at NSSavePanel.h you'll see: IBOutlet NSTextField *_nameField; This is the text field for the file name. All you have to do is set it. The idea is to add a setter in a category like this:


@interface NSSavePanel(My_Extensions)
- (void)setFileName:(NSString*)newName;
@end


@implementation NSSavePanel(CPExtensions)

- (void)setFileName:(NSString*)newName
{
if (newName && _nameField)
[_nameField setStringValue:newName];
}

@end

HTH, Rob


On Dec 12, 2005, at 8:47 PM, Derrick Bass wrote:

I want to create a new filename from the old name (say Movie.mov ->
Movie-modded.mov) and present that as the default name to save under.
But I'm not quite sure how to go about it. I haven't noticed any
simple way to do it.

_______________________________________________
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: Setting initial filename for Save As
      • From: Derrick Bass <email@hidden>
    • Re: Setting initial filename for Save As
      • From: Corbin Dunn <email@hidden>
  • Prev by Date: CoreData: "Can't reassign an object to a different store once it has been saved."?
  • Next by Date: Re: Creating sounds programatically
  • Previous by thread: Re: Setting initial filename for Save As
  • Next by thread: Re: Setting initial filename for Save As
  • Index(es):
    • Date
    • Thread