addCommandItem is not working in this extraAppleMenuItems, only addItem which doesn’t give any options for having a key short cut. Unless I’ve missed something?
This came up 14 years ago but unsurprisingly the example linked is now dead, and been unable to find anything else on the topic in here.
OK, I must be doing something stupid because I tried basically to add a normal item (“About”) followed by a separator and then the command item, but only the “About” item showed up in the “Apple” menu.
Thanks for posting the dummy project, that should help me work out where I’ve gone wrong.
Edit: Fixed the issue. I’m not sure why this was a problem though:
I had a PopupMenu member in a class that I added the items to in its constructor and then had a method to get a pointer to said PopupMenu. This doesn’t work, I thought because perhaps it was an order of initialisation issue and my ApplicationCommandTarget wasn’t yet set up, but that didn’t help.
However when I use the same arrangement that you have here then it all works (which I thought surprising as I figured you can’t just create a PopupMenu on the stack to pass a pointer to MenuBarModel::setMacMainMenu for scope reasons, but seems not an issue).
I figure i did that after reading someone else code.
Lot’s of trial and error also by the way!
IIRC order of some application initialisations matters.
It’s not very obvious at first view but the PopupMenu is copied.