7

I have applied a style to a VCL application in Delphi XE2, but it works OK, but it seems that the main menu has ignored the style. See attached image. Is this a normal behavior?enter image description here

Any advice on how to apply style to the main menu?

RRUZ
  • 134,889
  • 20
  • 356
  • 483
Alexandre
  • 507
  • 1
  • 5
  • 16
  • 3
    See [`this comment`](http://theroadtodelphi.wordpress.com/2012/03/06/adding-vcl-styles-support-to-a-tpopupmenu-in-2-lines-of-code/#comment-1756). Rodrigo suggests there to use `TActionMainMenuBar` instead of `TMainMenu`. But he'll be soon or later here with the answer, I'd say :-) – TLama Jul 16 '13 at 21:18

1 Answers1

10

This is a limitation of the TMainMenuBarStyleHook Vcl Style hook. The normal approach to fix this kind of issue is create and register new TMainMenu Style hook, but unfortunately this Vcl Style hook is used internally by the TFormStyleHook (the vcl style hook of the forms), so this will require which you create a new form style hook as well and this implies a lot of work.

So my suggestion is replace the TMainMenu for a TActionMainMenuBar component which works very well with the vcl styles.

enter image description here

RRUZ
  • 134,889
  • 20
  • 356
  • 483
  • perhaps you can use in-memory patching instead of re-creating form hook from scratch ? – Arioch 'The Jul 17 '13 at 06:32
  • 1
    In this particular case, patching the method in memory using a detour will require a similar effort than writing the Vcl Style Hook from scratch. – RRUZ Jul 17 '13 at 06:37