VB - Tabbed MDI Child Windows Without Third Party Controls

TigerStyle
TigerStyle used Ask the Experts™
on
Hellow !

i am working on an application which works with mutliple
MDI child windows at a time and i want all of them to be accessible with a tabbed interface , so whenever a new document is initialized or created ... we should get a tab for it at the bottom or top and can switch between the different windows. What we want here is something very similar to the tabbed interface in "The opera browser"
, "Netcaptor" etc.

Now i have come across some third party controls to implement the same ... but i was wondering if there is a way to do this without using anything third party and just Visual Studio 6.0

any and all input is appreciated !!

thank you

best regards
TS
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
On the MDI parent, put a tab control inside a picturebox (so the picturebox can be "docked to the left/right,top, or bottom).  before you show a child form, add the form to a collection on the MDI parent.  Then create a new tab.  When the tab is clicked, get the tab index and get the MID Child form from the collection to show it.  When you close a MDI child form, remove it from the collection and remove the tab.

Author

Commented:
hi Twalgrave !

thanks for your help !

an example or some sample code would be great.
(i'm still having trouble with it)

best regards
TS
I did it without a collection to make it a little easier.

Here's the project setup

1 MDIForm name MDIForm1
3 Forms - each with the MDIChild = true
  Form1 - Tag = 0 (set in design time) Caption = "Inventory"
  Form2 - Tag = 1 (set in design time) Caption = "Prices"
  Form3 - Tag = 2 (set in design time) Caption = "Stocking"

Menu System on MdiForm1
mnuForms - caption = Forms
   mnuFormsInventory - caption = Inventory
   mnuFormsPrices - caption = Prices
   mnuFormsStocking - caption = Stocking

MDIForm1:
Contains a pictureBox (picture1) with the alignment set to bottom
Contains SSTab1 (Microsoft Tabbed Dialog Control) inside of Picture1.  The # of tabs gets set at runtime so no need to fiddle with it in design time.

This code goes into MDIForm1:
Private Sub MDIForm_Load()
   
    SSTab1.Tabs = 3
    SSTab1.TabVisible(0) = False
    SSTab1.TabVisible(1) = False
    SSTab1.TabVisible(2) = False

   
End Sub

Public Sub addFormToTab(oForm As Form)
   
    SSTab1.TabCaption(oForm.Tag) = oForm.Caption
    SSTab1.TabVisible(CInt(oForm.Tag)) = True
    SSTab1.Tab = CInt(oForm.Tag)
   
End Sub
Public Sub HideTab(oForm As Form)
   
    SSTab1.TabVisible(CInt(oForm.Tag)) = False

End Sub


Private Sub mnuFormsInventory_Click()
   
    Form1.Show
   
End Sub

Private Sub mnuFormsPrices_Click()
    Form2.Show
End Sub

Private Sub mnuFormsStocking_Click()
    Form3.Show
End Sub

Private Sub SSTab1_Click(PreviousTab As Integer)
   
    Dim oForm As Form
    For Each oForm In Forms
        If oForm.Tag = CStr(SSTab1.Tab) Then
            Exit For
        End If
    Next
   
    oForm.Show
   
End Sub

This code goes into each of the Form1, Form2, Form3 forms:
Private Sub Form_Load()
   
    Call MDIForm1.addFormToTab(Me)
   
End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
    Call MDIForm1.HideTab(Me)
End Sub


PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in Community Support that this question is:
- points to twalgrave
Please leave any comments here within the
next seven days.
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial