Solved

Hide an MDI.Child from WindowList

Posted on 1998-10-26
13
210 Views
Last Modified: 2008-03-10

Just how would you hide or even better, never have the MDI
Clild counted by the Windowlist property.

I have to trick it somehow, but the form must stay an
MDI.Child.

Thank you.
0
Comment
Question by:idcvbteam
  • 3
  • 3
  • 2
  • +4
13 Comments
 
LVL 1

Expert Comment

by:wford
ID: 1441747
if you put the form as visible = false after you load, it is loaded but not visible and does not occur on the window list.

This seems a little simple, maybe I missed something in your question
0
 
LVL 18

Expert Comment

by:deighton
ID: 1441748
me.hide in the form activate event
0
 
LVL 1

Expert Comment

by:wford
ID: 1441749
As long as you set visible/hide after the form Load event of your MDIchild.
0
 

Author Comment

by:idcvbteam
ID: 1441750

Professionals,

I do not want to hide it at all,
take VB5 or 6 for example, you have an Toolbar and a Properties Bar that are MDI.Child's but yet not displayed in the Window List.

I have the same thing in my project, and do not want the toolbars displayed or even
the MDI to read it.

Thank you.
0
 
LVL 1

Expert Comment

by:wford
ID: 1441751
The toolbar and Poject window are not MDIchild forms, if you have a look, you can move them out of the MDI window, They are always on top forms for the MDI window, and the docking is done either by overlaying the form on top of a panel fixed on the form, or by transferring a container from a form and assigning it to a panel on the MDI window.  

You can set the toolbar docking to off so that tools and menus are not added to the MDI parent form. Otherwise you have to change the settings on the MDI Parent, But I do not have referance material for this at the moment.


0
 
LVL 15

Expert Comment

by:ameba
ID: 1441752
Simple solution:
Add PictureBox to your MDIForm, set Alignment property to Left, and copy all controls from your form to this PictureBox.

0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 2

Expert Comment

by:kswinney
ID: 1441753
Set the MDIChild property of the form to false.  Then use the SetParent API function to make the form a child of the MDI parent's container window.  Then you won't see it on the window list.  There are some side effects of doing it this way that you may have to subclass around... like the title bar highlighting, etc.

Cheers!
0
 
LVL 2

Expert Comment

by:kswinney
ID: 1441754
idcvbteam,

The other method is to build and maintain the window list yourself.  I can create a small project to show you how this is done if you wish... but it's easy.  You need to create a menu item that's invisible with an index of 0.  Then you "load" a new member of the array and make it visible as you load each new MDI Child form.

Please let me know if you want a sample.

Ken.
0
 

Author Comment

by:idcvbteam
ID: 1441755

KsWinney,

Sorry the setparent didn't work well at all, but I am interested
in your WindowList function.
Will it add new clients, and delete them once they are unloaded?
How about when their is more then 10?





0
 
LVL 1

Expert Comment

by:zivf
ID: 1441756
What you said is that you need some floating toolbar, or whether you want it to float only inside the MDI parent form.
Why won't you open the form from the MDI form, and set the owner in the show methof to the MDIForm object?
Or rather you want an MDI child form that isn't MDI child?... this is what your question sounds like in a snap.
0
 
LVL 3

Accepted Solution

by:
fguerreiro_inix earned 230 total points
ID: 1441757
I've made the WindowList function.
Check this code.

You must unselect the WindowList property in the menu builder.
Create an menu array bellow that item.
Call that menu array mnuTest (to make an menu array, just put 0 in the index property).

This is the code for the menu you have just created.

Private Sub mnuTest_Click(Index As Integer)

   For iPos = 0 To Forms.Count - 1
       If Forms(iPos).Caption = mnuTest(Index).Caption Then
           Forms(iPos).Show
           Forms(iPos).SetFocus
       End If
   Next iPos
end sub



This is the main sub that works around the menu (adds and hides menu items):

Public Sub WinList(Main As Form, Child As Form)

Dim iPos As Integer
Dim iFlag As Boolean

If Main.Controls("mnutest").ubound = 0 Then
    Load Main.mnuTest(1)
    Main.mnuTest(1).Caption = Child.Caption
    Main.mnuTest(1).Visible = True
    Exit Sub
End If
For iPos = 0 To Main.Controls("mnutest").ubound
   If Trim$(Main.mnuTest(iPos).Caption) = trim$(Child.Caption) Then
      Main.mnuTest(iPos).Visible = Not Main.mnuTest(iPos).Visible
      Exit Sub
    End If
Next iPos

Load Main.mnuTest(Main.mnuTest.ubound + 1)
Main.mnuTest(Main.mnuTest.ubound).Caption = Child.Caption
Main.mnuTest(Main.mnuTest.ubound).Visible = True

end sub

You must call this sub like this:
WinList Forms(0), Me      '--- In each form unload event

and
WinList Forms(0), Me      '--- before you show each form for the
                          '--- very first time.  

The WinList procedure should be in a Module.



Hope this helps
Regards


0
 

Author Comment

by:idcvbteam
ID: 1441758

fguerreiro_inix,

Thank you very much,
just before I award you the points,
could you please tell me

WinList Forms(0), Me
                       '--- very first time.
What the very first time comment means?
Must I change the value on other forms?

Also...
In the MenuBuilder,
mnuWindow
      mnuTest(0)
but why is it that when I run it, mnuTest is still Visible...
The windowList works well, it writes the form.caption underneath it.
How would you hide it?
0
 
LVL 3

Expert Comment

by:fguerreiro_inix
ID: 1441759
Sorry I said a little mistake

You must call this sub like this:
WinList Forms(0), Me      '--- In each form unload event
                          '--- Forms(0) represents the MDI form
                          '--- For some reason doesn't accept
                          '--- the name of the form (works this
                          '--- way)

AND
 
WinList Me, formChildName '--- After you show each child form
                          '--- for the very first time.
                          '--- Assuming that you call child
                          '--- forms from your MDI.
   
Like this in one MDI event or procedure:

frmChildOne.show          '--- To show child one form
WinList Me, formChildName '--- To call the routine that puts
                          '--- the menu in window list.


If you want more explanation before grading, say something

Hope this helps
Regards
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Use closed file on desktop in vba 6 65
Add a task in Outlook from access 11 35
Visual Studio search word table and return Cell index 8 48
Child Form in front 4 34
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

948 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now