4

When I add, for example, a TPanel to a form and align it using alTop and then add a TMainMenu to the same form, the main menu position overrides the panel position such that the Main Menu remains topmost on the form with the panel appearing below it.

Is it possible to override the TMainMenu position so I can add a component like a Panel above it and the Main Menu below it?

Alternatives like TActionManager and/or TToolBar are not suitable because of BiDi compatibility issues.

J...
  • 30,968
  • 6
  • 66
  • 143
LEO
  • 43
  • 2
  • 1
    Nope, the menu isn't even in the client area. – Sertac Akyuz Apr 05 '19 at 13:39
  • That sounds like I have to restructure application GUI to avoid Windows limitations. Thank you for your answer. – LEO Apr 05 '19 at 14:43
  • Have a look at [TToolBar](http://docwiki.embarcadero.com/Libraries/en/Vcl.ComCtrls.TToolBar), [TActionMainMenuBar](http://docwiki.embarcadero.com/Libraries/en/Vcl.ActnMenus.TActionMainMenuBar), or [TRibbon...](http://docwiki.embarcadero.com/RADStudio/en/Creating_an_Application_that_Uses_Ribbon_Controls) as an alternative menu that you can position as desired – Remy Lebeau Apr 05 '19 at 16:31

1 Answers1

3

No, the main menu is a Windows component and its location is fixed. This isn't a Delphi limitation but a restriction on how menus work with windows in Windows.

From MSDN (emphasis mine) :

Only an overlapped or pop-up window can contain a menu bar; a child window cannot contain one. If the window has a title bar, the system positions the menu bar just below it. A menu bar is always visible.

If you want menu-like behaviour in a component which you can freely place anywhere on your form, you would need to either write one yourself or look for third-party alternatives.

Community
  • 1
  • 1
J...
  • 30,968
  • 6
  • 66
  • 143
  • Thank you very much for your clarification. I have tried also TMS components but apparently that almost all components they have an issue with BiDi mode when switching to RightToLeft mode even the Ribbon control. – LEO Apr 05 '19 at 14:38