Re: Setting initial filename for Save As
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