CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Thread: MDI Child Forms

  1. #1
    Join Date
    Jul 1999
    Posts
    84

    MDI Child Forms

    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

  2. #2
    Join Date
    Jan 2000
    Location
    Olen, Belgium
    Posts
    2,477

    Re: MDI Child Forms

    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
    [email protected]

    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
    Tom Cannaerts
    email: [email protected]
    www.tom.be (dutch site)

  3. #3
    Join Date
    Dec 1999
    Location
    Dublin, Ireland
    Posts
    1,173

    Re: MDI Child Forms

    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
    '--8<-----------------------------------------
    NEW -The printer usage monitoring application
    '--8<------------------------------------------

  4. #4
    Join Date
    Aug 1999
    Location
    Bangalore, INDIA
    Posts
    70

    Re: MDI Child Forms

    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





  5. #5
    Join Date
    Jan 2000
    Location
    Olen, Belgium
    Posts
    2,477

    Re: MDI Child Forms

    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
    [email protected]

    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
    Tom Cannaerts
    email: [email protected]
    www.tom.be (dutch site)

  6. #6
    Join Date
    Dec 1999
    Location
    Dublin, Ireland
    Posts
    1,173

    Re: MDI Child Forms

    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
    '--8<-----------------------------------------
    NEW -The printer usage monitoring application
    '--8<------------------------------------------

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured