On Aug 21, 2008, at 11:18 AM, Andy Lee wrote:

On Aug 21, 2008, at 1:55 PM, R.L. Grigg wrote:
Yes, that's a cool feature. But if I have three versions of AppController.m up at once, it would be great to be reminded -- at a glance -- which one is which, especially since I get so many interruptions. So if the path was on the title bar, that'd be cool. But I guess it's not so easy to change TextEdit to do this.

Did you not see my earlier reply?

Funny, it didnt come in until your second post.

On Aug 20, 2008, at 12:26 PM, Andy Lee wrote:
Sounds like TextEdit is an NSDocument-based app. I'm not familiar with those, but I see NSDocument has a -displayName method whose documentation says:

"If the document has been saved, the display name is the last component of the directory location of the saved file (for example, “MyDocument” if the path is “/tmp/MyDocument.rtf”). If the document is new, NSDocument makes the display name “Untitled n,” where n is a number in a sequence of new and unsaved documents. The displayable name also takes into account whether the document’s filename extension should be hidden. Subclasses ofNSWindowController can override windowTitleForDocumentDisplayName:to modify the display name as it appears in window titles."

This would explain why you didn't see an explicit call to - setTitle: in the code -- that's taken care of by the framework. You can override to customize the framework's default behavior.


I just added the following to DocumentWindowController and it had the desired effect:


- (NSString *)windowTitleForDocumentDisplayName:(NSString *)displayName
{
   NSURL *fileURL = [[self document] fileURL];

   if (fileURL)
       return [fileURL path];
   else
       return [super windowTitleForDocumentDisplayName:displayName];
}

Overriding -windowTitleForDocumentDisplayName: works perfectly!
Thanks, Andy!

Russ

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to