Hey @reuk, is it impossible to have dynamic enable state for items in the Mac main menu?
Here is what I do:
macExtrasMenu.addCommandItem( getCommandManager(), cmdPreferences );
view->setMacMainMenu( view, &macExtrasMenu );
view->getMacMainMenu()->setApplicationCommandManagerToWatch( getCommandManager() );
As you mentioned, I also have the issue where the command target is not viable at the time I create the Mac menu, so
Preferences appears disabled.
I added this:
PopupMenu::MenuItemIterator itr( macExtrasMenu, false );
while ( itr.next() )
if ( itr.getItem().itemID == CommandIDs::cmdPreferences )
itr.getItem().setEnabled( true );
It enables the command in the Mac main menu as expected.
This issue though is that this command is supposed to be disabled under some conditions.
setApplicationCommandManagerToWatch seems to have no effect: the command info is never requested.
I even tried to perform manual enable/disable on a timer using the iterator method above, but it seems that once the menu is created, you cannot update the commands enablement.
What am I missing?