I recently updated juce to latest version and I noticed that menus no longer properly display shortcut text.
I do not use CommandManager. I simply separated item text with < end> and old juce version displayed this as shortcut text.
Latest version uses updateShortcutKeyDescription() to generate property shortcutKeyDescription. It is no longer possible to manually assign value.
I could manually set shortcutKeyDescription property but PopupMenu::addItem does not return created menu item.
I will modify juce source but please make custom shortcut text available again.
In case anyone is interested - I recently published preview version of PlanetCNC TNG software which is made with Juce. It can be downloaded for free here: https://planet-cnc.com/software/
Here is my solution. Please include it in your source.
void PopupMenu::addItem(int itemResultID, const String& itemText, bool isActive, bool isTicked, const String& shortcutText)
i.text = itemText;
i.itemID = itemResultID;
i.isEnabled = isActive;
i.isTicked = isTicked;
i.shortcutKeyDescription = shortcutText;
Sorry, but that’s exactly the sort of method that we don’t want the PopupMenu class to have! The point of the recently-added Item subclass was so that all the many addItem() methods would no longer be needed, and we may even one day deprecate them. By using a structure like PopupMenu::Item that contains all the info, it means we can add and modify that data in the future without having to change all the addItem calls and breaking people’s code.
…but of course, there’s no reason at all why you’d need us to add this anyway. If it’s a function you need regularly, you can just write it yourself as a free function that takes a PopupMenu and adds the item to it.
Ok, I’ll use “Item” directly. I don’t know why I thought Item is declared private but I see now that it is public…