There are several menuNeedsUpdate methods for various popup menus, but there doesn't appear to be a menu delegate set in the MIUserInterface nib and hence it isn't clear to me where the best places is to put a menuNeedsUpdate method.
The obvious thing, to me, is to make MIUserInterfaceController the menu delegate -- but it seems way far removed from MIDocumentWindowController. Okay, so two questions:
a) is there a better place to put the menu delegate? I guess I could programmatically wire MIDocumentWindowController as the menu delegate rather than in IB, but MIUserInterfaceController seems like the right place for it.
b) Thus showing my lack of significant Cocoa experience, I'm betting that there is a way from within the MIUserInterfaceController to get the handle to the MIDocumentWindowController, yes?
Gavin.
Can you describe what your
Can you describe what your end goal is? Each NSMenu may (most do not) have a delegate, if the menu has a delegate then menuNeedsUpdate will be called on that delegate. Note that each submenu is also a is really a new NSMenu, so their are many NSMenu's and the possibility of many different menu delegates.
The only time (well the most common time, maybe there are others) that you need to set a delegate is when a menu will have a variable number of items, such as the columns list, or the different menu's that list Mori entries.
The general way to implement a dynamic menu would be.
1. Insert a new menu item by creating a class that extends BKMenuContributerProtocol, and make that class extend some menu extension point, such as com.hogbaysoftware.ui.mainmenu.
2. That allows you to insert a single menu item that you have control over. Now you can add a submenu to that item, and make one of you classes the delegate of that submenu. And you can implement menuNeedsUpdate in that delegate class and that's how you get a dynamic menu.
Let me know if that helps. In general you're delving into what I think is the worst designed/hardest to use part of Blocks. If you have ideas for making the menu extension system easier/better please let me know! :)
Jesse