[Openmcl-devel] Deep menu magic
ron at flownet.com
Tue Feb 2 01:44:31 UTC 2010
I'm trying to create a context menu that works kind of the the File->Open Recent menu, that is, it has a dynamically changing list of selections. In trying to figure out how to implement this, I went poking around inside the Open Recent menu and discovered to my surprise that the file items don't actually seem to be there:
? (#/submenu (#/itemAtIndex: (#/submenu (#/itemAtIndex: (#/mainMenu #&NSApp) 1)) 3))
#<NS-MENU <NSMenu: 0x5b5090>
Title: Open Recent
Supermenu: 0x5b50d0 (File), autoenable: YES
"<NSMenuItem: 0x1285d0 Clear Menu>"
Where are the file items (and the separator for that matter)? Can someone point me to a description of how menus like this actually work? (In particular, what are the item actions on these dynamically generated menu items? #/addItemWithTitle:action:keyEquivalent: doesn't let you pass an argument to the selector, so to make something like Open Recent work using that method you'd need a separate selector for each item. Which is possible, but seems pretty ugly.
More information about the Openmcl-devel