Updating buttons and menus belonging to just a single CommandID?


#1

I've been looking at my code, and I do the following an awful lot - update the status (checked, disabled) of one CommandID, and then call menuItemsChanged() and commandStatusChanged(), which update everything?

It'd be great if there were a way to just update ONE CommandID, so Juce didn't have to recompile the world every time.  

(Oh, and do I really need to call menuItemsChanged()?  Probably not - but then under what circumstances SHOULD I call menuItems changed?  Only when the actual menu entries are different?)


#2

Well.. The listeners that will react to that callback should check whether the changes actually have any effect on them before doing any expensive operations, so it's probably not a problem to call it fairly often.

menuItemsChanged() should be called when items on your menus may have changed state, as I think on OSX the menu items are created when they change, not when the menu is actually shown. But it should still be a pretty cheap operation - if you do see any performance hotspots, let me know and it might be tweakable.