Forum > LCL

How to customize style of TMainMenu and TPopupMenu?

(1/2) > >>

tu:
I want to customize styles of TMainMenu and TPopupMenu, eg: changing menu item color.

But it seems TMainMenu and TPopupMenu are OS-dependent. I used OwnerDraw with customized OnDrawItem and OnDrawItem but it works only on Windows.

I want to customize menu styles which support cross-platform: Windows, macOS (Cocoa) and Linux (QT, GTK). Is it possible to do that?

Thank you so much,  :)

Handoko:
You can easily write your own popup menu. For example this is my popup with listbox in the User Interface section in the link below:
https://wiki.freepascal.org/Portal:HowTo_Demos#User_Interface

For TMainMenu, I still have no idea.

LV:
Maybe make MainMenu something like this?
Tested on both Windows 11 and Linux(gtk2). Please take a look at the attached project.

Handoko:
Nice!

But things will become complicated if we need sub menus.

tu:
It seems does not have any easy way to custom menu. Thank you so much :)

One more question. Is there any solution (built-in component, external libraries...) to custom draw menu?  :)

Navigation

[0] Message Index

[#] Next page

Go to full version