Multiple Main Menus in MDI Application

Member_2_99151
Member_2_99151 used Ask the Experts™
on
Hi,

It is possible to have a separate menu in a Child Window within an MDI application?

If you use the "MainMenu" component, it is not. Are there any components that allow this to happen???

Thanks,

James
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Senior developer, analyst and customer assistance
Commented:
The only way that i know is this:

Place on your MDIChild a TToolBar component and a TMainMenu component
Link the ToolBar.Menu to MainMenu
Populate the TMainMenu items using different GroupIndex that those used in the MDI Main Form, so they will not be merged on the MainForm.

This way you will have a mainmenu for the childform. Just remember to differentiate the groupindexes between the forms (a TMainMenu can have all the items with the same groupindex, but it must be different from the one on the MainForm)

Author

Commented:
Thanks for the suggestion...
The GroupIndex looks pretty useful, but it is not quite what I am after.

I actually need a menu at the top of the child form as well as one for the parent.
I have looked at using other components, but none appear to dock at the top leaving the remainder of the form as the client area...

Any ideas?
Ferruccio AccalaiSenior developer, analyst and customer assistance

Commented:
Have you tried what I've suggested?  It does exactly this!
Look at the screenshots attached
design.jpg
designmenu.jpg
runtime.jpg
Expert Spotlight: Joe Anderson (DatabaseMX)

We’ve posted a new Expert Spotlight!  Joe Anderson (DatabaseMX) has been on Experts Exchange since 2006. Learn more about this database architect, guitar aficionado, and Microsoft MVP.

Author

Commented:
Hi,

I did try what you suggested but the menu still appeared on the MDI Parent. When one or more children were open, both sets of menus are merged into the main window.

The images you attached are exactly what I am after, so I am doing something wrong!

Are you able to attach the sample for the above for me to compare mine against?

Thanks
Ferruccio AccalaiSenior developer, analyst and customer assistance

Commented:
Of Course. It's a simple default Delphi MDI Application.
Wait a moment, I have to recreate it ;)
Ferruccio AccalaiSenior developer, analyst and customer assistance

Commented:
Here it is
MDI.zip

Author

Commented:
Thanks...

In the sample you have, it does display the menus in the Child ToolBar, but the 'File' menu still merges into the main window.

Is it possible to stop this from happenning?

Author

Commented:
Actually, if you tell the parent window that there is no menu, but add a toolbar to it linked to MainMenu1 it works fine :-)

Author

Commented:
Thanks for the help :-)

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial