11 Vote

Delphi/Lazarus: Show Separator Line in Menu

Question by Guest | 2016-09-27 at 23:46

In some other applications, I have seen, that sometimes, individual menu items are separated from each other with some kind of dividing line. This is often used, for example for grouping some menu items belonging together thematically.

However, I have never seen the possibility to set or create such a divider using Delphior Lazarus. I have searched the object inspector for both, the MainMenu (TMainMenu) as well as the PopupMenu (TPopUpMenu).

1Best Answer1 Vote

Indeed, there is no real option for this available, you just have to know the trick:

For creating a separator line, you have to set the caption of the corresponding menu item to "-". As soon as the caption is only consisting of a hyphen, when starting the application, a menu divider is created thereof.

MenuItem1.Caption := 'Item before Divider';
MenuItem2.Caption := '-';
MenuItem3.Caption := 'Item after Divider';

Here is a small example showing this behavior: MenuItem2 is becoming the separator, the items before and after are displayed with their normal caption.
2016-09-28 at 15:34

ReplyPositive Negative

Related Topics

Important Note

Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.


Ask your own question or write your own article on askingbox.com. That’s how it’s done.