On 17/02/2010, at 15:53 , Graham Cox wrote: > On 17/02/2010, at 6:49 PM, Peter N Lewis wrote: > >> Is there any way to dynamically populate a popup menu on the fly (as it is >> exposed)? > > Look into the NSMenuDelegate protocol. It has methods to do what you want.
Yes, that looks like it will do what I need. Hopefully the code will be fast enough to just use - (void)menuNeedsUpdate:(NSMenu *)menu otherwise I'll have to do a bit more work to get - (NSInteger)numberOfItemsInMenu:(NSMenu *)menu - (BOOL)menu:(NSMenu *)menu updateItem:(NSMenuItem *)item atIndex:(NSInteger)index shouldCancel:(BOOL)shouldCancel working. And I did know about NSPopUpButtonWillPopUpNotification, and indeed that was what I was using, but unfortunately it was taking about a minute to populate the menu, and therein lies the problem. The menu is only about three or four levels deep in the normal case, and a menu selection is definitely the right UI for this use case, not a browser or some other mechanism. About the only other good UI would be a big custom UI designed specifically for this use, and that's more work than I want for little or no gain in usability. Thanks for the comments! Peter. -- Keyboard Maestro 4.0.2 now released! Brand new interface! Keyboard Maestro <http://www.keyboardmaestro.com/> Macros for your Mac <http://www.stairways.com/> <http://download.stairways.com/> _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com