LEO
LEO

Reputation: 43

How to place a component above a TMainMenu?

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.

Upvotes: 4

Views: 756

Answers (1)

J...
J...

Reputation: 31403

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.

Upvotes: 3

Related Questions