Forum > LCL

[Solved] Adding a named separator

(1/3) > >>

sarad:
Hello freaks  ;)

How I can add a named separator (menu group) to a T*Menu?
My desired sytax is - Name -.

VisualLab:

--- Quote from: sarad on April 15, 2024, 10:17:34 am ---Hello freaks  ;)

How I can add a named separator (menu group) to a T*Menu?
My desired sytax is - Name -.

--- End quote ---

This cannot be done easily in classes (TMainMenu, TPopupMenu) responsible for displaying individual menu items (TMenuItem). You would probably need to refer to WinAPI (Windows) or to the functions contained in the Qt or GTK libraries (Linux). Another solution is to create your own class that displays the menu.

There is one more issue. I suspect that these separators are intended to play two roles:

* real separator,
* a description for the set of commands included below this spearator.
If this is the case, I advise against this solution. This is an example of bad GUI design. A multi-level menu is provided for this purpose, i.e. a higher-level menu item groups and describes lower-level items. Users are well familiar with this solution. However, various "fancy" or "contrived" menu options will irritate users. Unless it's a program for your own needs, then it's OK.

Thaddy:
I am ot quite sure, but if a name is required, simply use a macro.

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---{$macro on }{$define name :=-}

sarad:

--- Quote from: VisualLab on April 15, 2024, 10:39:12 am ---There is one more issue. I suspect that these separators are intended to play two roles:

* real separator,
* a description for the set of commands included below this spearator.
If this is the case, I advise against this solution. This is an example of bad GUI design. A multi-level menu is provided for this purpose, i.e. a higher-level menu item groups and describes lower-level items. Users are well familiar with this solution. However, various "fancy" or "contrived" menu options will irritate users. Unless it's a program for your own needs, then it's OK.

--- End quote ---

Thank you for your answer.
I think it's good that you are taking this into account.

My idea is just a compromise between many levels and clarity.

I want to prevent the menu from being more than three levels deep.
And above all, I hope that it will provide an overview.
Like a separator, but with a clear indication of what's being separated.

So, you are right.

wp:
Maybe a menu is not the kind of GUI that you need? A bit more complex is the ribbon-like TSpkToolbar which provides at least three well-separated levels of access: the ribbon tabs, the panes, and the buttons, and when you have buttons with ButtonKind bkButtonDropDown or bkDropDown you can even provide a standard dropdown menu which, of course, can have its submenus: https://wiki.freepascal.org/SpkToolbar. Several panes can be available in a tab, and each pane is labeled.

Navigation

[0] Message Index

[#] Next page

Go to full version