How is "Open Recent >" identified and populated?
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