• 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
How is "Open Recent >" identified and populated?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How is "Open Recent >" identified and populated?


  • Subject: How is "Open Recent >" identified and populated?
  • From: Jerry Krinock <email@hidden>
  • Date: Tue, 25 Aug 2009 08:33:24 -0700

Today I wanted to add a menu item with a submenu similar to "Open Recent". For example, Xcode has:

   ...
   Open Recent File ->
   Open Recent Document ->
   ...

For convenience, I copy/paste/duplicated the "Open Recent" menu item, connected everything, wrote my code, but then found that my new menu item was populated with recent documents and a "Clear Menu" item. In other words, my code was ignored and instead it became another "Open Recent" item.

I solved the problem by dragging a new menu item out of the Interface Builder library and starting over from scratch, because I could not figure out how Cocoa identifies the "Open Recent" menu item!

As far as I can see, the "Open Recent" menu item and its submenu are not special in any way -- no tags, no targets, no actions, no connections, no bindings, no special subclass. The "Clear Menu" item of the submenu does have a connection to First Responder's - clearRecentDocuments:, but removing that in my duplicate didn't change the behavior.

Is there some magic under the covers? How does Cocoa know which menu item is "Open Recent"?

Sincerely,

Jerry Krinock

_______________________________________________

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: How is "Open Recent >" identified and populated?
      • From: "I. Savant" <email@hidden>
  • Prev by Date: How to keep the last tree item of NSOutlineView in the most bottom of a Sidebar?
  • Next by Date: Re: NSTableView and programmatic changing of contextual menu
  • Previous by thread: Re: How to keep the last tree item of NSOutlineView in the most bottom of a Sidebar?
  • Next by thread: Re: How is "Open Recent >" identified and populated?
  • Index(es):
    • Date
    • Thread