On May 23, 2008, at 2:51 PM, [EMAIL PROTECTED] wrote:

How do I set my document based application to omit the filename reference at
the top of each opened document window?

Kyle Sluder's explanation is quite informative, but it may also be more complicated than you need. If you really just want to change the name of your document, you can override -[NSDocument displayName] like this:

// Adding this method to your document subclass will cause the
// title of every document window to be "Foo".
- (NSString *)displayName
{
    return @"Foo";
}


If you want to also remove the file proxy icon (small icon next to the window title), you'll likely want to create a custom window controller as described by Kyle and implement either the - windowDidLoad: or -awakeFromNib methods such that you get a reference to the icon button and send it a -setHidden: message, like this:

// Put the following in your custom window controller where it'll
// be executed soon after the window is loaded.
NSButton *fileButton =
        [window standardWindowButton:NSWindowDocumentIconButton];
if (fileButton != nil) {
    [fileButton setHidden:YES];
}

The reason for putting the code above in a custom window controller is that ideally, your document class shouldn't be in the business of defining what the window should look like. The window controller is a better place for that.

cheers,

Caleb Strockbine
_______________________________________________

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