Solved

Hide an MDI.Child from WindowList

Posted on 1998-10-26
13
209 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
Comment Utility
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
Comment Utility
me.hide in the form activate event
0
 
LVL 1

Expert Comment

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

Author Comment

by:idcvbteam
Comment Utility

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
Comment Utility
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
Comment Utility
Simple solution:
Add PictureBox to your MDIForm, set Alignment property to Left, and copy all controls from your form to this PictureBox.

0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
LVL 2

Expert Comment

by:kswinney
Comment Utility
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
Comment Utility
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
Comment Utility

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

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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

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…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we 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…

763 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

12 Experts available now in Live!

Get 1:1 Help Now