Results 1 to 16 of 16

Thread: MDI and child forms

  1. #1

    Thread Starter
    Lively Member Steve Cain's Avatar
    Join Date
    Sep 2000
    Location
    Wiltshire, UK
    Posts
    105

    Question MDI and child forms

    Can anyone help with this problem? I am using VB6.

    I have a project that runs with the MDI form set to run maximized (windowstate = 2).

    Child form A is also set to run maximized (windowstate = 2).

    Child form B is set to run normal (windowstate = 0).

    Run project - MDI is maximised - OK. Show form A and that is maximised - OK.

    Show form B and that is also OK (both forms now shown on the MDI).

    Problem: Now that form B is shown, form A now changes to normal(windowstate 0) like form B.

    Am I going loopy or what?

    Thanks,

    Steve.

  2. #2
    Fanatic Member
    Join Date
    Apr 2002
    Posts
    638
    that's one of the silly things about MDI forms - all child forms have the same windowstate. either they're all maximized, or all normal.

  3. #3

    Thread Starter
    Lively Member Steve Cain's Avatar
    Join Date
    Sep 2000
    Location
    Wiltshire, UK
    Posts
    105
    Thanks for that, should have guessed there would be a simple answer.

    Cheers.

  4. #4
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: MDI and child forms

    Originally posted by Steve Cain
    Can anyone help with this problem? I am using VB6.

    I have a project that runs with the MDI form set to run maximized (windowstate = 2).

    Child form A is also set to run maximized (windowstate = 2).

    Child form B is set to run normal (windowstate = 0).

    Run project - MDI is maximised - OK. Show form A and that is maximised - OK.

    Show form B and that is also OK (both forms now shown on the MDI).

    Problem: Now that form B is shown, form A now changes to normal(windowstate 0) like form B.

    Am I going loopy or what?

    Thanks,

    Steve.
    you could also use a non child form and using the setparent api function you could make that non child window appear to be a child window... basically it will be contained within the MDI form like a child... but not act like an MDI child form.. great for doing what it sounds like you are working with

  5. #5
    Fanatic Member
    Join Date
    Apr 2002
    Posts
    638
    the only problem i have with that is that when the child form gets focus, the MDI form loses focus, which looks odd.

  6. #6

    Thread Starter
    Lively Member Steve Cain's Avatar
    Join Date
    Sep 2000
    Location
    Wiltshire, UK
    Posts
    105
    Thanks Matt, sounds like a good work around.

  7. #7
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373
    Originally posted by tr0n
    the only problem i have with that is that when the child form gets focus, the MDI form loses focus, which looks odd.
    true... but it still does the trick none the less if it is needed.

  8. #8
    Hyperactive Member maxl's Avatar
    Join Date
    Jan 2002
    Location
    Montréal
    Posts
    384
    You could also set the desired window state at the activate event of each form. Not exactly what you're looking for, but each form that has the focus would have the correct state.
    COBOL sa suce !!!

  9. #9

  10. #10
    VB6, XHTML & CSS hobbyist Merri's Avatar
    Join Date
    Oct 2002
    Location
    Finland
    Posts
    6,654
    Why not use? MDI forms are great I use them in my app and working fine this far.

    I just wonder, is it possible to place a form on MDI form so that it's not in the child form area? I mean, could it be there like a picturebox that is set on the MDI form?

  11. #11
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632
    MDI Forms are great if they are used correctly. Only about 1% of applications require MDI forms. MDI forms are designed to be used for an application that has many of the same form open, ie Word, you can have loads of word docs open, and the MDI form controls them. If you have many different forms that open then MDI forms should NOT be used. they cause far too many problems than people expect. Trust me on that one

    i just add the above to my signiture since I keep quoting it everywhere hahaha.
    Errr...what do you mean about a picture box?
    You can have a form that is not an MDI child and open that and it will appear outside of the MDI form...

    Woka

  12. #12
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687
    The MDI environment has it's place, but it should be weighed heavily. In some cases it makes sense, and in others it doesn't. In our app, because of the design, it made sense. We have an MDI form w/ an "Outlook"-style navigation bar (dynamically loaded based on the user's permission settings). As they click on the icon a form opens with the proper screen on it (each screen was created as an ActiveX control
    When we move to .NET, using the MDI may not make sense, and we'll probably come up w/ some other setup.
    I agree that MDI should be avoided at all costs, but sometimes.......
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  13. #13
    VB6, XHTML & CSS hobbyist Merri's Avatar
    Join Date
    Oct 2002
    Location
    Finland
    Posts
    6,654
    Yeah, the program of mine is an advanced text-editor

    I mean: normal MDIchild appears in the dark-grey area of the form. I'd like the form appear in the edgepart of the MDI form. Like if it was a toolbar, picturebox or a statusbar set on the MDI form itself.

    Just a nice little trick I'd like to try out

  14. #14

    Thread Starter
    Lively Member Steve Cain's Avatar
    Join Date
    Sep 2000
    Location
    Wiltshire, UK
    Posts
    105
    Thanks guys for the comments and help, I think I've got a clear picture now. Anothe issue that I now have is that if I open up a child form (normal - 0) windowstate and that form is fairly large (19000 x 14000 twips) then it does not open to its full size. The right side and bottom are cut off. There are no scroll bars, but I can drag the bottom-right corner to reveal the full form or I can maximise the form.

    Steve.

  15. #15
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632
    Techgnome...er....fair enough, very strange way of doing it though.

    Stevie Cain...Theif! You stole Martin Liss's avatar hahahahaha

    Woka (would be VERY unhappy if someone stole his avatar)

  16. #16

    Thread Starter
    Lively Member Steve Cain's Avatar
    Join Date
    Sep 2000
    Location
    Wiltshire, UK
    Posts
    105
    I've had the image on my PC for years, not sure where I got it but it was freely available in the public domain and I have seen it used on many web-sites.

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