• 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: Removing the Filename flag in Doc. based Application
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Removing the Filename flag in Doc. based Application


  • Subject: Re: Removing the Filename flag in Doc. based Application
  • From: Caleb Strockbine <email@hidden>
  • Date: Sat, 24 May 2008 04:02:21 -0400

On May 23, 2008, at 2:51 PM, email@hidden 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 (email@hidden)

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:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Removing the Filename flag in Doc. based Application
      • From: Mark Piccirelli <email@hidden>
  • Prev by Date: Re: Cleaning up a singleton
  • Next by Date: Re: Query about Zip command
  • Previous by thread: Re: Removing the Filename flag in Doc. based Application
  • Next by thread: Re: Removing the Filename flag in Doc. based Application
  • Index(es):
    • Date
    • Thread