How to: MenuBar item with command AND sub-menu


I have a MenuBar component which has File, Edit, About etc. dropdown menus. Those work as intended with all their sub-menus and all when there’s
a command

However, when I add a command on the, say, “File” MenuBar item, it won’t open its sub-menus anymore.
Clicking it triggers the event but doesn’t open the dropdown menu attached to “File.”

I’d like to have an event triggered when the user clicks File with the sub-menus still showing as usual.

In short: How to have a MenuBar item have a command attached to it while still being able to show its dropdown menus.

Thank you.

Hi Vesa.

It seems that by design, the MenuBar API works in a way that MenuItem is a submenu (no command) or it is an item (no command), but you cannot have both.

This is confusing API design, and there is a ticket about it:

Hi, Pekka.

I see. Well I rewrote a part of my application so I got around it. Thanks for the info, anyway.