MdiWindowListItem


Author
Message
Michael Cobb
Michael Cobb
StrataFrame Beginner (26 reputation)StrataFrame Beginner (26 reputation)StrataFrame Beginner (26 reputation)StrataFrame Beginner (26 reputation)StrataFrame Beginner (26 reputation)StrataFrame Beginner (26 reputation)StrataFrame Beginner (26 reputation)StrataFrame Beginner (26 reputation)StrataFrame Beginner (26 reputation)
Group: Forum Members
Posts: 26, Visits: 1K
This is a good thread.  This may be slightly off topic but I wasn't sure where to post this question. 

I have a main MDI form with the following method that is used to launch a child form.

    Private Sub LaunchForm(ByVal FormType As System.Type, Optional ByVal AllowMultiple As Boolean = True)
        '-- Look to see if the form is already loaded - bring to front
        If AllowMultiple = False Then
            For Each loCurForm As Form In Me.MdiChildren
                If Not loCurForm.InvokeRequired Then    ' Can access the form directly
                    If loCurForm.GetType() Is FormType Then
                        If loCurForm.WindowState = FormWindowState.Minimized Then
                            loCurForm.WindowState = FormWindowState.Maximized
                        End If

                        loCurForm.BringToFront()
                        Exit Sub
                    End If
                End If
            Next
        End If

        '-- Establish Locals
        Me.Cursor = Cursors.WaitCursor

        Dim loForm As Form
        loForm = CType(Activator.CreateInstance(FormType), Form)

        '-- Set the MDI
        loForm.MdiParent = Me

        '-- Show the form
        loForm.Show()

        Me.Cursor = Cursors.Default
    End Sub

The child form has a control which needs to open a new child form in the main MDI form.  Any ideas about how to accomplish this?

Thanks for looking!

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
I think that the best thing to do would be to expose the MDI client...or....if your main form just has the MDIContainer property set you can reference it directly.  When the form is launched it will have a reference to the parent form in the ParentForm property which you can type and reference.  You may need to make your LauncForm method public or Friend so it can be accessed though.

DirectCast(Me.ParentForm, MainForm).LaunchForm(GetType(MyChildForm))

If you are using an MDIClient control and manually adding it to the form, then you can just expose it through a public property and basically do the same thing:

DirectCast(Me.ParentForm, MainForm).MDIClientProperty.LaunchForm(GetType(MyChildForm))

Michael Cobb
Michael Cobb
StrataFrame Beginner (26 reputation)StrataFrame Beginner (26 reputation)StrataFrame Beginner (26 reputation)StrataFrame Beginner (26 reputation)StrataFrame Beginner (26 reputation)StrataFrame Beginner (26 reputation)StrataFrame Beginner (26 reputation)StrataFrame Beginner (26 reputation)StrataFrame Beginner (26 reputation)
Group: Forum Members
Posts: 26, Visits: 1K
Thanks Trent.  This works perfectly!
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Glad it worked for you Smile
StarkMike
StarkMike
StrataFrame User (448 reputation)StrataFrame User (448 reputation)StrataFrame User (448 reputation)StrataFrame User (448 reputation)StrataFrame User (448 reputation)StrataFrame User (448 reputation)StrataFrame User (448 reputation)StrataFrame User (448 reputation)StrataFrame User (448 reputation)
Group: Forum Members
Posts: 436, Visits: 944
Hi guys,

A couple of questions.... I am using a picture that you used earlier in the post... how did you create that MDI with that control panel on the left?

am i correct in assuming that if the user were to click or double click on the name of a form in the list in the control panel it would show that form?

and second, using the code you provided earlier in this post... how would I create navigation buttons to utilize this code... lets say that I wanted navigation buttons in the MDI to be able to navigate through all the child forms... yknow the basics... first, previous, next, last.

This is a really cool concept! I'm eager to implement it. BigGrin

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Well, basically this is just a docked Panel on the main form which we custom render and then add the logic we need for MDI Window Activation.  One thing that you can do is create an MDIClient class and then add that class as a control to the main form rather than setting the MdiContainer property....it just gives you more flexibility.

This entire explanation would be more of a tutorial rather than a quick post here...and in fact, this is one of the very things that we cover during class.  I know you guys haven't had a chance to make it to class in the past, but if it were at all possible, I think that you guys would gain a lot of first hand experience on items just like this if you were able to make it to the next class Smile 

Teddy Jensen
Teddy Jensen
StrataFrame Novice (112 reputation)StrataFrame Novice (112 reputation)StrataFrame Novice (112 reputation)StrataFrame Novice (112 reputation)StrataFrame Novice (112 reputation)StrataFrame Novice (112 reputation)StrataFrame Novice (112 reputation)StrataFrame Novice (112 reputation)StrataFrame Novice (112 reputation)
Group: StrataFrame Users
Posts: 52, Visits: 8K
Ivan,

Your main form looks really good. I too was first thinking of a toolstrip dropdown that would show the open windows.  Now i have decided to use a panel like yours and the one from Practice Studio, so i can use it to show some more info. I do however have issues with this (read - it doesn't look the way i want it)

Can you describe how you did your panel and lists?

TIA.

/Teddy

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Really all you need to do is set the MdiParent property on the parent form to False.  Drop a FlowLayoutPanel (or ThemedPanel) on the form and dock it left.  Next, in your main form, define an MdiClient class (it is a control) as a private and manually add it to the form.  This MdiClient will be where all of there client forms will appear, but the panels docking will be left intact.

Private _MdiClient As New MdiClient()


Public Sub New()
    _MdiClient.BackColor = Color.White
    Me.Controls.Add(_MdiClient)
End Sub


Teddy Jensen
Teddy Jensen
StrataFrame Novice (112 reputation)StrataFrame Novice (112 reputation)StrataFrame Novice (112 reputation)StrataFrame Novice (112 reputation)StrataFrame Novice (112 reputation)StrataFrame Novice (112 reputation)StrataFrame Novice (112 reputation)StrataFrame Novice (112 reputation)StrataFrame Novice (112 reputation)
Group: StrataFrame Users
Posts: 52, Visits: 8K
Hi Trent,

Thanks - i got it now. My problem was that i set the text of an employee form to the name of the employee after it is loaded from a browsedialog. So i wanted the new text of the form to be renamed/refreshed in the list.

The rest was just cosmetic customations of the properties.

/Teddy

Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
Hi Teddy.

I'm glad Trent could help you, he got all this from me... oh, wait, I think the orther of the words are not set properly...

Unsure

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search