Alex Rivera | Logout

How to add menu items separators which work as expected on OSX?

Asked 2011-09-21T19:34:02.123
9

On Windows platform, with the VCL, when we want to add a separator in a menu, we add a TMenuItem with a Caption := '-';

With FireMonkey, we add a TMenuItem with a Text := '-';

It works as expected on Windows platform, the item with the Text='-' is displayed as a separator.

But, when I run the same application on OSX, I have the minus sign visible...

I haven't found any property on the TMenuItem to specify it is a separator...

I have tried with a TMainMenu and a TMenuBar (UseOSMenu := True|False;) and I still have this issue.

Any idea to create a real separator? (otherwise, I will check the OS and remove it if OSX...)

Edit
Report

1 Answer

0

I never programmed for the Mac, and I don't eveb have a Mac but out of curiosity I found some Apple Documentation about it.

The Menu Separator item is a disabled blank menu item, maybe you can fake with that:

separatorItem

Returns a menu item that is used to separate logical groups of menu commands. + (NSMenuItem *)separatorItem Return Value

A menu item that is used to separate logical groups of menu commands.

Discussion

This menu item is disabled. The default separator item is blank space.

(From: http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/ApplicationKit/Classes/NSMenuItem_Class/Reference/Reference.html#//apple_ref/doc/c_ref/NSMenuItem)

answered 2011-09-21T22:51:17.047

Your Answer