Jump to content
Alexander Halser

MacOS bug: TMainMenu subitems auto-close on click

Recommended Posts

On MacOS when using a TMainMenu that integrates into the Apple system menu bar, sub-menus automatically close the entire menu when clicked, as illustrated in the screenshot.


My configuration:

Delphi 11
MacOS Big Sur

Before I get into this really deep, could someone please confirm (or not) that this is a Delphi bug?

Ideally with Delphi 11 plus an older version.


Steps to reproduce the issue:

  1. Create a new project
  2. Drop a TMainMenu on the form
  3. Add several menu items with subitems
  4. No onclick handlers required, just go and run on MacOS


This bug occurs on the native Apple menu only. The bug occurs with all menu items that represent a submenu.

There's no such problem with TPopupMenu and there's no problem on Windows with TMainMenu at all.

Screenshot 2022-07-03 at 14.26.33.png

  • Like 1

Share this post

Link to post

I removed Apple platforms from earlier versions of Delphi but I confirm this functionality on a quick D11 app. At first, I wasn't completely sure what the problem was but then I used the PAServer app on the Mac and in it's Edit menu, there's a "Copy Special" menu with sub-menu items and clicking on "Copy Special" does not close the sub-menu; a sub-menu with sub-items in the test app does close the menu as if there were an action attached to the sub-menu. I would agree that it's not consistent with typical Mac menu functionality.

Share this post

Link to post

Wow, you are right! Apple's Terminal app does have direct click handlers for some submenu items. 

Well, if Apple does it, it must be a feature and can't be a bug, can it? :classic_biggrin:

Now we've to find a way in Delphi to make this feature optional...

Share this post

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now