Results 1 to 2 of 2

Thread: A really basic question on MDI and SDI

  1. #1
    m29
    m29 is offline VB.NET Forum Newbie
    .NET Framework
    Join Date
    Dec 2004
    Posts
    1
    Reputation
    0

    A really basic question on MDI and SDI

    A real novice question from an experienced programmer.

    I need to write an application with multiple forms. I can't see a reason to make it an MDI application since there is no real "documents" that can be instanciated, only well defined independent windows.

    I once wrote a VB6 SDI application with one base form that showed the other forms in a modal way when needed. But then I had a problem. When the user minimized the modal form, the base form still appeard. Not only it was ugly , he couldn't reach it since the modal window is still alive but minimized. So what I did was tracking the forms and minimize them all from the code.

    I really really don't want to go through this pain process again. I want the application to minimize all the forms of the application when he minimizes the top one. Any trick you know of ? (property or alike, not running over the forms collection and minimize them all .... )

    I figured, why won't I make it an MDI after all ... no minimize problems there.
    so I started writing that, I showed the first form as a child. then I closed it ( all from the code ) , but then when I wanted to show another one or even the same form again , he didn't start from the top left corner of the father area but a bit to the left and down. as if the previous instance is still there and it's cascading the childs. no matter what I did, forced the location to 0,0 and all kinds of tricks, shwing the second and third childs and so forth never "sat" in the right place. Always a bit to the right and down or even streching to fill the father rectangle ...

    so I guess I have 2 questions :
    1. About the SDI thing. Any trick in causing the calling form to be minimized once the user minimize the top midal form ?

    2. In MDI application that the documents are actually independent forms, how can you force them to fill the rectangle and "sit" from 0,0 ?

  2. #2
    JuggaloBrotha's Avatar
    JuggaloBrotha is offline VB.NET Forum Moderator
    .NET Framework
    .NET 4.0
    Join Date
    Jun 2004
    Location
    Lansing, MI; USA
    Posts
    4,362
    Reputation
    974
    SDI: declare a Variable for each form in a module so when any of the forms are minimized you can have it minimize all the other forms, and when you restore (bring it from the taskbar back to the screen) you can then have it bring up the other windows as well such as:
    any form's LocationChanged event
    Code:
      If Me.WindowState = FormWindowState.Minimized Then MainWindow.WindowState = FormWindowState.Minimized
    mainform's LocationChanged event
    Code:
       If Me.WindowState = FormWindowState.Minimized And blnCompairOpen = True Then CompairWindow.Visible = False
      		If Me.WindowState = FormWindowState.Normal And blnCompairOpen = True Then
      			CompairWindow.Visible = True
      			CompairWindow.WindowState = FormWindowState.Normal
      		End If
    MDI: it's a windows standard that's included with all microsoft programming languages to have all child windows cascade as they're opened. there's no way around it that i know of

    note: the code posted above was taken straight out of a program i've written and is only their for logic, not actual use

Bookmarks

Posting Permissions

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