Skip navigation.
 
mlRe: Removing the Filename flag in Doc. based Application
FROM : Mark Piccirelli
DATE : Tue May 27 23:33:45 2008

There's some advice about this in the "Advice for Overriders of -
[NSDocument displayName]" section of the AppKit release notes at http://developer.apple.com/releasenotes/Cocoa/AppKit.html.
  (Searching for "advice" on that page turns up a couple of other 
tidbits too.)

               -- Mark

On May 24, 2008, at 1:02 AM, Caleb Strockbine wrote:

> On May 23, 2008, at 2:51 PM, <email_removed> 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_removed>)
>
> 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/<email_removed>
>
> This email sent to <email_removed>

Related mailsAuthorDate
mlRemoving the Filename flag in Doc. based Application vince May 23, 18:33
mlRe: Removing the Filename flag in Doc. based Application Kyle Sluder May 23, 23:13
mlRe: Removing the Filename flag in Doc. based Application Roland King May 24, 05:06
mlRe: Removing the Filename flag in Doc. based Application Kyle Sluder May 24, 06:52
mlRe: Removing the Filename flag in Doc. based Application Caleb Strockbine May 24, 10:02
mlRe: Removing the Filename flag in Doc. based Application Mark Piccirelli May 27, 23:33