Re: Open Recent Menu
Re: Open Recent Menu
- Subject: Re: Open Recent Menu
- From: "Jeff Bland" <email@hidden>
- Date: Tue, 14 Aug 2007 17:09:17 -0600
After playing around with Text Edits NIB file, it appears that the Open
Recent menu HAS to be created by inserting the default file menu. Once the
Open Recent menu has been created by Interface Builder it can be moved
around. Creating a menu of the exact name in the exact spot and exactly all
the same attributes, in interface builder, or in code, will not work.
So, as far as I can tell, the document manager recognizes the Open Recent
menu by checking a what seems to be an internal, undocumented and uneditable
flag that gets loaded from a NIB.
My menu's are generated in code currently, but I can move all that into a
NIB to get the automatic Open Recent menu, but not all programs can use nibs
(not to mention many people who prefer to code), and it would be nice if
someone from Apple would tell us how this works - or if they would add a
document manager message to tell Cocoa what menu we want managed as the open
recent menu.
For now, I'll try loading my menu from a NIB using the Interface Builder's
special Open Recent menu.
On 8/14/07, PGM <email@hidden> wrote:
>
> >
> > Actually the NSDocument controller is doing the saving for me so I
> > do'nt
> > have to manage a file myself. Your plan for repopulating the menu
> > is good -
> > and I will go about that if I can't find a way to have the system
> > do it. I
> > believe the system can do it (even in non-document based applications)
> > because I don't see any code in TextEdit that manually inserts
> > items in the
> > open recent menu.
> >
> > Also if I can figure out how to get the system to manage my open
> > recent menu
> > I get standard behavior, and nifty things like:
> >
> > "Thanks to changes in Cocoa, TextEdit's recent documents menu will now
> > correctly track documents whose volumes or enclosing folders have been
> > renamed."
> >
> > Although I'm not sure if that's referring to the Recent Items menu
> > under the
> > apple menu or the open recent menu under the file menu.
> >
>
> Have you tried to simply insert the standard Open Recent menu-item
> into your menu?
>
> I tried in the TextEdit nib, and removed the Open Recent item, and
> there was no compile warning or error that the item was missing. I
> then dragged a File-menu item from the Menus pallette of IB into the
> textEdit menu (so that there are two File-menus). Then I dragged the
> Open Recent-item from the newly inserted File-menu to the old one
> (had to click and hold it before being able to drag it to another
> menu), and then deleted the newly inserted File-menu (so that the old
> one remained). After recompiling, the Open Recent-menu again worked
> as expected.
>
> I may be far oof, but I guess the documentController simply
> recognizes the item and populates it automagically.
>
> Hope this helps, Patrick
>
>
_______________________________________________
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