[Openmcl-devel] Deep menu magic

Ron Garret ron at flownet.com
Mon Feb 1 17:44:31 PST 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
	Items:     (
        "<NSMenuItem: 0x1285d0 Clear Menu>"
    ) (#x5B5090)>

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.

Thanks,
rg




More information about the Openmcl-devel mailing list