Link to home
Start Free TrialLog in
Avatar of szayeri
szayeri

asked on

Right aligned menubar

Please help me:

How can I make Form1.MainMenu stick to right, without changing the BiDiMode of Form1. I mean any thing is ok but MainMenu1.

More Detail: I'm in XP with Delphi7 and like to run my application in any version of Windows.
ASKER CERTIFIED SOLUTION
Avatar of Wim ten Brink
Wim ten Brink
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of szayeri
szayeri

ASKER

Dear Workshop Alex

Thank You. Your code works fine but there is some questions remaining:
1) How can I force menu items to be redrawn in order to make them appear at right? They are actually right aligned but their position before redrawing does not say so.
2) when I rename Edit1 every thing goes back. why is it so and how much can I trust in this code in special conditions (renaming, changing menuindex, closing form and so on)?
The problem with my solution is that while you explicitly tell the menu to be right-alighned once, the TMemu component isn't really aware of this yet. Thus, when the TMenu recreates the menu for whatever reason, (like renaming) it will bring the menu back to it's original position. Basically, you should inherit a new component from TMainMenu and add the functionality for this new right-alignment property, which is not an easy job. This new component could then respond to changes in the menu and make sure the MFT_RIGHTJUSTIFY is set for a specific menuitem.
Basically, the whole secret behind right-aligned menus is just this flag...