Click to See Complete Forum and Search --> : MDI Child Forms


Harini
June 25th, 2001, 03:51 PM
Hello,

I have created an MDI application in which there are number of child forms, which are activated as per the btns clicked in the toolbar of the parent form.

The problem is when I click on the title bar of any of the child forms (except one form), the menu bar on the parent form disappears.

Please help me out urgently....


Thanks
Harini

Cakkie
June 26th, 2001, 01:05 AM
I'm affraid that this is a behaviour that just comes with MDI windows. I haven't found a workaround, and Microsoft doesn't mention anything about how to overcome this. I've tried some things, like using several API's, but this causes you to lose some of the advantages of MDI windows.

Sorry

Tom Cannaerts
slisse@planetinternet.be

Programming today is a race between software engineers striving to build bigger and better idot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook

Clearcode
June 26th, 2001, 04:26 AM
I could not reproduce this behaviour.

Using the Toolbar control that is part of "Microsoft Common Controls" OCX and setting Align=vbAlignTop then the toolbar is always visible whether or not a MDI child has the focus.

If you are usiong a toolbar control that doesn't support the Align property - try putting it inside a picture box control on the MDI Parent that does have Align=vbAlignTop and resizing it when the picturebox resizes..

HTH,
D.

-------------------------------------------------
Ex. Datis: Duncan Jones
Merrion Computing Ltd
http://www.merrioncomputing.com

Sharathms
June 26th, 2001, 05:40 AM
Hi ,
we faced the same problem and we have found out this work around.
What we do is,
1. Create all the menus in the mdi form itself (but write the fuinctionality in the correpsonding forms (or child forms)
2. Me all the menus (which were supposed to be on the child forms) invisible
3. when ever required (by the child form), enable (or make it visible) the required menus

for us, this idea is working fine.
cheers,
Sharath

Cakkie
June 26th, 2001, 05:51 AM
Hi Merrion,

we're talking about menu's here. The behaviour of toolbars can be controlled with the negotiatetoolbars property, but there's no such thing for menu's.

Just create an MDI form, add an MDI child, create a menu (like file) on the parent, create another menu (like edit) on the child form. Run the program, activate the child form and watch... (in the parent form, there should only be a edit menu, which has moved from the child to the parent).
Now, lets say you got a popup on your child window, let's set the visible property of the edit menu to false. Run it again, and watch, now, there's no menu bar at all.
That's the strange (and frustrating) behaviour we are talking about

Tom Cannaerts
slisse@planetinternet.be

Programming today is a race between software engineers striving to build bigger and better idot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook

Clearcode
June 26th, 2001, 06:47 AM
Oddly, the MSDN information seems to suggest that an WM_MDISETMENU command should be sent by the parent to the client to set the menu to use. I cannot see this message being send by VB when I subclass the forms, however.

If you have a menu item that has no caption and set it .Enabled = False but .Visible = True the menu bar doesn't dissappear but this still looks very odd.

The way VB handles menus is totally different from the way other Win32 apps handle menus, so it is possible that the MDI menu stuff is also done using notify messages that we are unaware of.

HTH,
D.

-------------------------------------------------
Ex. Datis: Duncan Jones
Merrion Computing Ltd
http://www.merrioncomputing.com