• 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: Recently Opened in Doc
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Recently Opened in Doc


  • Subject: Re: Recently Opened in Doc
  • From: Quincey Morris <email@hidden>
  • Date: Sat, 28 Jan 2012 12:32:43 -0800

On Jan 28, 2012, at 11:57 , Brad Stone wrote:

> Thanks Quincey, I've already subclassed my NSDocumentController and I use noteNewRecentDocument to prevent my index file from showing up in the list.   The code never gets past the continue call because every time this method is called the only menu item  in [openRecentMenu itemArray] is "Clear Menu" (except when I quit out).
>
> - (void)noteNewRecentDocument:(NSDocument *)aDocument {
>     if ([aDocument isKindOfClass:[PNDocument class]]) {
>         [super noteNewRecentDocument:aDocument];
>     }
>
>     NSMenu *fileMenu = [[[NSApp mainMenu] itemWithTitle:@"File"] submenu];
>     if (!fileMenu) {
>         return;
>     }
>     NSMenu *openRecentMenu = [[fileMenu itemWithTitle:@"Open Recent"] submenu];
>     if (!openRecentMenu) {
>         return;
>     }
>
>     for (NSMenuItem *openRecentMenuItem in [openRecentMenu itemArray]) {
>         NSString *title = [openRecentMenuItem title];
>         if ([title isEqualToString:@"Clear Menu"]) {
>             continue;
>         }
>        // code to change the menuItem title
>
>     }
> }

There's a couple of things I don't understand here.

If your document is a PNDocument, then you never add it to the menu via the super call, so of course there's no item there to have its name changed.

OTOH, unless your app has multiple doc classes AND the others use regular file names AND you're trying to mix regular file names and your special names on the same menu, then why are you bothering to leverage the document controller mechanism? Just opt out, and create your own Recent Items mechanism to use instead.

The problem with trying to integrate into any of document controller's standard behavior is that you might end up "fixing" the menu, but that won't solve anything for the dock menu, which was your original question.

_______________________________________________

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


References: 
 >Re: Recently Opened in Doc (From: James Merkel <email@hidden>)
 >Re: Recently Opened in Doc (From: Brad Stone <email@hidden>)
 >Re: Recently Opened in Doc (From: Quincey Morris <email@hidden>)
 >Re: Recently Opened in Doc (From: Brad Stone <email@hidden>)

  • Prev by Date: Re: Recently Opened in Doc
  • Next by Date: Re: Blocks and Methods...
  • Previous by thread: Re: Recently Opened in Doc
  • Next by thread: Re: Recently Opened in Doc
  • Index(es):
    • Date
    • Thread