Solved

Hide an MDI.Child from WindowList

Posted on 1998-10-26
13
213 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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 

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
 
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

831 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