• 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: Derrick Bass <email@hidden>
  • Date: Tue, 13 Dec 2005 20:04:43 -0600

On Dec 13, 2005, at 12:03 PM, Robert Martin wrote:

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:


Oh, that's EVIL! I like it. But where would I call this new setFileName method?

Of couse, I really should follow Simon Strandgaard's advice and override saveDocumentAs:. The reason I was hesitant is that there is a bunch of functionality that the standard saveDocumeAs: method has that I need to duplicate, so I was trying to override lower level (and presumably simpler) methods instead. One behavior I need to duplicate, for example, is bringing up a nice error dialog if the save fails. The thing that worries me is... is there other functionality I've never seen before that I should duplicate also?

Oh, and I'm still wondering if there's a way to tell if my new filename is too long.

Derrick

_______________________________________________
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: Setting initial filename for Save As (From: Robert Martin <email@hidden>)

  • Prev by Date: Re: _arrangedObjects not allocated
  • Next by Date: install_name_tool & glib
  • Previous by thread: Re: Setting initial filename for Save As
  • Next by thread: Getting the arguments of methods in other frameworks (from GDB)
  • Index(es):
    • Date
    • Thread