473,706 Members | 3,978 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

MenuStrip -- Mdi merge

Could someone explain how to merge the form menu with the mdi container
window. The menu strip items on the form window merge but I either end up
with a blank blue menu on the form or top list of items that don't do
anything.

MDI Container.IsMdi Container = true

MenuStrip.Allow Merge = true
/// First menu items
this.miFile.Mer geAction = System.Windows. Forms.MergeActi on.Insert;
this.miFile.Mer geIndex = 1;
this.miFile.Nam e = "miFile";
this.miFile.Siz e = new System.Drawing. Size(35, 20);
this.miFile.Tex t = "&File";

/// On the sub form
this.miFile.Dro pDownItems.AddR ange(new System.Windows. Forms.ToolStrip Item[]
{
this.toolStripS eparator1,
this.miClose});
this.miFile.Mer geAction = System.Windows. Forms.MergeActi on.MatchOnly;
this.miFile.Mer geIndex = 1;
this.miFile.Nam e = "miFile";
this.miFile.Siz e = new System.Drawing. Size(35, 20);
this.miFile.Tex t = "&File";

Regards,
John
Dec 15 '05 #1
4 21676
I struggled with this for ages and eventually, by trial and error, got it
working. Best to show where I got to with an illustration of the MergeAction
and MergeIndex values

MDI parent form has a "File" menu with the generally available options:

Item Merge Action Merge Index
File Append 1
New Append 2
Open Append 2
Print Setup Append 25
Exit Append 99

All of these items are handled by methods on the MDI parent form.

The MDI child form also has a file menu, with options specific to a child
form:

Item Merge Action Merge Index
File MatchOnly -1
Close Insert 2 (Inserts
Close after item 2)
---- Insert 3 (separator
bar)
Save Insert 4
Save-as Insert 5
----- Insert 6
Print Insert 7
Print Preview Insert 8

All of these menu items are handled by methods on the mdi child form. When a
child form is opened, the entire child menu gets merged between the "open"
and "Print setup" items of the parent menu.

Next job was to insert an "edit" menu after the "file" menu. Since there is
no such menu on the parent form, I needed to add a new one from the child
form. On the child, I defined:

Item Merge Action Merge Index
Edit Insert 2
Undo Append -1
< rest of the options are the same >

In this case, because the Edit menu is a top level menu, it gets inserted
after top level item "1", which is the "file" menu from the parent form.
Because there is no merging of lower level items, I can append them all in
the child form.

Hope some of that makes sense. I have no idea whether it's the "right" thing
to do because the documentation and examples are non-existent. However, it
works.

You'll also be pleased to know that, when you come to merge toolbars, the
rules change completely!

HTH
Steve

"John J. Hughes II" <no@invalid.com > wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
Could someone explain how to merge the form menu with the mdi container
window. The menu strip items on the form window merge but I either end up
with a blank blue menu on the form or top list of items that don't do
anything.

MDI Container.IsMdi Container = true

MenuStrip.Allow Merge = true
/// First menu items
this.miFile.Mer geAction = System.Windows. Forms.MergeActi on.Insert;
this.miFile.Mer geIndex = 1;
this.miFile.Nam e = "miFile";
this.miFile.Siz e = new System.Drawing. Size(35, 20);
this.miFile.Tex t = "&File";

/// On the sub form
this.miFile.Dro pDownItems.AddR ange(new
System.Windows. Forms.ToolStrip Item[] {
this.toolStripS eparator1,
this.miClose});
this.miFile.Mer geAction = System.Windows. Forms.MergeActi on.MatchOnly;
this.miFile.Mer geIndex = 1;
this.miFile.Nam e = "miFile";
this.miFile.Siz e = new System.Drawing. Size(35, 20);
this.miFile.Tex t = "&File";

Regards,
John

Dec 16 '05 #2
Steve,

First thanks for the detailed response.

I sort of fixed the problem by setting the child form's menu strip visible
property to false.

I change my menus based on your suggestion. Mainly changed the parent menu
upper items to "Append" with the location index being correct for where I
want them. Then I changed the child form menu items parents to -1 / match
only. I can only assume they are using the name to match with so I made
sure the name are the same.

All the sub items are merging correctly on the parent menu but the child
form still has a menu strip with a list of parent items that does nothing.
Oh well as I said I changed the child menu form's menu strip visible
property to false and the problem seems to be solved.

And yes I agree a good sample would be nice from MS. The compression sample
the BOL leads you too is beyond useless.

Don't you just love guessing games?

Regards,
John

"Steve Barnett" <no****@nodomai n.com> wrote in message
news:eJ******** ********@TK2MSF TNGP11.phx.gbl. ..
I struggled with this for ages and eventually, by trial and error, got it
working. Best to show where I got to with an illustration of the
MergeAction and MergeIndex values

MDI parent form has a "File" menu with the generally available options:

Item Merge Action Merge Index
File Append 1
New Append 2
Open Append 2
Print Setup Append 25
Exit Append 99

All of these items are handled by methods on the MDI parent form.

The MDI child form also has a file menu, with options specific to a child
form:

Item Merge Action Merge Index
File MatchOnly -1
Close Insert 2 (Inserts
Close after item 2)
---- Insert 3 (separator
bar)
Save Insert 4
Save-as Insert 5
----- Insert 6
Print Insert 7
Print Preview Insert 8

All of these menu items are handled by methods on the mdi child form. When
a child form is opened, the entire child menu gets merged between the
"open" and "Print setup" items of the parent menu.

Next job was to insert an "edit" menu after the "file" menu. Since there
is no such menu on the parent form, I needed to add a new one from the
child form. On the child, I defined:

Item Merge Action Merge Index
Edit Insert 2
Undo Append -1
< rest of the options are the same >

In this case, because the Edit menu is a top level menu, it gets inserted
after top level item "1", which is the "file" menu from the parent form.
Because there is no merging of lower level items, I can append them all in
the child form.

Hope some of that makes sense. I have no idea whether it's the "right"
thing to do because the documentation and examples are non-existent.
However, it works.

You'll also be pleased to know that, when you come to merge toolbars, the
rules change completely!

HTH
Steve

"John J. Hughes II" <no@invalid.com > wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
Could someone explain how to merge the form menu with the mdi container
window. The menu strip items on the form window merge but I either end
up with a blank blue menu on the form or top list of items that don't do
anything.

MDI Container.IsMdi Container = true

MenuStrip.Allow Merge = true
/// First menu items
this.miFile.Mer geAction = System.Windows. Forms.MergeActi on.Insert;
this.miFile.Mer geIndex = 1;
this.miFile.Nam e = "miFile";
this.miFile.Siz e = new System.Drawing. Size(35, 20);
this.miFile.Tex t = "&File";

/// On the sub form
this.miFile.Dro pDownItems.AddR ange(new
System.Windows. Forms.ToolStrip Item[] {
this.toolStripS eparator1,
this.miClose});
this.miFile.Mer geAction = System.Windows. Forms.MergeActi on.MatchOnly;
this.miFile.Mer geIndex = 1;
this.miFile.Nam e = "miFile";
this.miFile.Siz e = new System.Drawing. Size(35, 20);
this.miFile.Tex t = "&File";

Regards,
John


Dec 16 '05 #3
Sorry, yes, you're right - I didn't say to hide the menu strip on the child
form. I am doing that too.

The items that are appropriate for the parent form are handled by the parent
form... that's where I put their handlers. This for the child are handled by
the child because that's where I put their handlers. I have no "duplicate"
items on both forms though... you seem to imply you do.

You'll have far more fun when you get to merge tool bars - they merged
automatically in the Beta version of VC# Express and then stopped merging
automatically in the final release. I now have to merge them my self with
some very unintuitive code.

At some stage, I may strip out the more advanced stuff I put in to my editor
and upload it as an example to CodeProject... either that or I'll have
Christmas off!

All the best
Steve
"John J. Hughes II" <no@invalid.com > wrote in message
news:uu******** *****@TK2MSFTNG P12.phx.gbl...
Steve,

First thanks for the detailed response.

I sort of fixed the problem by setting the child form's menu strip visible
property to false.

I change my menus based on your suggestion. Mainly changed the parent
menu upper items to "Append" with the location index being correct for
where I want them. Then I changed the child form menu items parents to -1
/ match only. I can only assume they are using the name to match with so
I made sure the name are the same.

All the sub items are merging correctly on the parent menu but the child
form still has a menu strip with a list of parent items that does nothing.
Oh well as I said I changed the child menu form's menu strip visible
property to false and the problem seems to be solved.

And yes I agree a good sample would be nice from MS. The compression
sample the BOL leads you too is beyond useless.

Don't you just love guessing games?

Regards,
John

"Steve Barnett" <no****@nodomai n.com> wrote in message
news:eJ******** ********@TK2MSF TNGP11.phx.gbl. ..
I struggled with this for ages and eventually, by trial and error, got it
working. Best to show where I got to with an illustration of the
MergeAction and MergeIndex values

MDI parent form has a "File" menu with the generally available options:

Item Merge Action Merge Index
File Append 1
New Append 2
Open Append 2
Print Setup Append 25
Exit Append 99

All of these items are handled by methods on the MDI parent form.

The MDI child form also has a file menu, with options specific to a child
form:

Item Merge Action Merge Index
File MatchOnly -1
Close Insert 2 (Inserts
Close after item 2)
---- Insert 3
(separator bar)
Save Insert 4
Save-as Insert 5
----- Insert 6
Print Insert 7
Print Preview Insert 8

All of these menu items are handled by methods on the mdi child form.
When a child form is opened, the entire child menu gets merged between
the "open" and "Print setup" items of the parent menu.

Next job was to insert an "edit" menu after the "file" menu. Since there
is no such menu on the parent form, I needed to add a new one from the
child form. On the child, I defined:

Item Merge Action Merge Index
Edit Insert 2
Undo Append -1
< rest of the options are the same >

In this case, because the Edit menu is a top level menu, it gets inserted
after top level item "1", which is the "file" menu from the parent form.
Because there is no merging of lower level items, I can append them all
in the child form.

Hope some of that makes sense. I have no idea whether it's the "right"
thing to do because the documentation and examples are non-existent.
However, it works.

You'll also be pleased to know that, when you come to merge toolbars, the
rules change completely!

HTH
Steve

"John J. Hughes II" <no@invalid.com > wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
Could someone explain how to merge the form menu with the mdi container
window. The menu strip items on the form window merge but I either end
up with a blank blue menu on the form or top list of items that don't do
anything.

MDI Container.IsMdi Container = true

MenuStrip.Allow Merge = true
/// First menu items
this.miFile.Mer geAction = System.Windows. Forms.MergeActi on.Insert;
this.miFile.Mer geIndex = 1;
this.miFile.Nam e = "miFile";
this.miFile.Siz e = new System.Drawing. Size(35, 20);
this.miFile.Tex t = "&File";

/// On the sub form
this.miFile.Dro pDownItems.AddR ange(new
System.Windows. Forms.ToolStrip Item[] {
this.toolStripS eparator1,
this.miClose});
this.miFile.Mer geAction = System.Windows. Forms.MergeActi on.MatchOnly;
this.miFile.Mer geIndex = 1;
this.miFile.Nam e = "miFile";
this.miFile.Siz e = new System.Drawing. Size(35, 20);
this.miFile.Tex t = "&File";

Regards,
John



Dec 16 '05 #4
Yea it was the visable thing that was throwing me. Very not obvious!

Just the parent items are common form the form to the parent. It was just
having the parent item on both the form and the container was a bit
confusing and ugly.

I don't think I will do the toolbar thing. I don't have much of a problem
on the few windows I have that use them just being on the form itself.

Thanks again for the help.

Regards,
John

"Steve Barnett" <no****@nodomai n.com> wrote in message
news:em******** *****@TK2MSFTNG P11.phx.gbl...
Sorry, yes, you're right - I didn't say to hide the menu strip on the
child form. I am doing that too.

The items that are appropriate for the parent form are handled by the
parent form... that's where I put their handlers. This for the child are
handled by the child because that's where I put their handlers. I have no
"duplicate" items on both forms though... you seem to imply you do.

You'll have far more fun when you get to merge tool bars - they merged
automatically in the Beta version of VC# Express and then stopped merging
automatically in the final release. I now have to merge them my self with
some very unintuitive code.

At some stage, I may strip out the more advanced stuff I put in to my
editor and upload it as an example to CodeProject... either that or I'll
have Christmas off!

All the best
Steve
"John J. Hughes II" <no@invalid.com > wrote in message
news:uu******** *****@TK2MSFTNG P12.phx.gbl...
Steve,

First thanks for the detailed response.

I sort of fixed the problem by setting the child form's menu strip
visible property to false.

I change my menus based on your suggestion. Mainly changed the parent
menu upper items to "Append" with the location index being correct for
where I want them. Then I changed the child form menu items parents
to -1 / match only. I can only assume they are using the name to match
with so I made sure the name are the same.

All the sub items are merging correctly on the parent menu but the child
form still has a menu strip with a list of parent items that does
nothing. Oh well as I said I changed the child menu form's menu strip
visible property to false and the problem seems to be solved.

And yes I agree a good sample would be nice from MS. The compression
sample the BOL leads you too is beyond useless.

Don't you just love guessing games?

Regards,
John

"Steve Barnett" <no****@nodomai n.com> wrote in message
news:eJ******** ********@TK2MSF TNGP11.phx.gbl. ..
I struggled with this for ages and eventually, by trial and error, got it
working. Best to show where I got to with an illustration of the
MergeActio n and MergeIndex values

MDI parent form has a "File" menu with the generally available options:

Item Merge Action Merge Index
File Append 1
New Append 2
Open Append 2
Print Setup Append 25
Exit Append 99

All of these items are handled by methods on the MDI parent form.

The MDI child form also has a file menu, with options specific to a
child form:

Item Merge Action Merge Index
File MatchOnly -1
Close Insert 2 (Inserts
Close after item 2)
---- Insert 3 (separator bar)
Save Insert 4
Save-as Insert 5
----- Insert 6
Print Insert 7
Print Preview Insert 8

All of these menu items are handled by methods on the mdi child form.
When a child form is opened, the entire child menu gets merged between
the "open" and "Print setup" items of the parent menu.

Next job was to insert an "edit" menu after the "file" menu. Since there
is no such menu on the parent form, I needed to add a new one from the
child form. On the child, I defined:

Item Merge Action Merge Index
Edit Insert 2
Undo Append -1
< rest of the options are the same >

In this case, because the Edit menu is a top level menu, it gets
inserted after top level item "1", which is the "file" menu from the
parent form. Because there is no merging of lower level items, I can
append them all in the child form.

Hope some of that makes sense. I have no idea whether it's the "right"
thing to do because the documentation and examples are non-existent.
However, it works.

You'll also be pleased to know that, when you come to merge toolbars,
the rules change completely!

HTH
Steve

"John J. Hughes II" <no@invalid.com > wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
Could someone explain how to merge the form menu with the mdi container
window. The menu strip items on the form window merge but I either end
up with a blank blue menu on the form or top list of items that don't
do anything.

MDI Container.IsMdi Container = true

MenuStrip.Allow Merge = true
/// First menu items
this.miFile.Mer geAction = System.Windows. Forms.MergeActi on.Insert;
this.miFile.Mer geIndex = 1;
this.miFile.Nam e = "miFile";
this.miFile.Siz e = new System.Drawing. Size(35, 20);
this.miFile.Tex t = "&File";

/// On the sub form
this.miFile.Dro pDownItems.AddR ange(new
System.Windows. Forms.ToolStrip Item[] {
this.toolStripS eparator1,
this.miClose});
this.miFile.Mer geAction = System.Windows. Forms.MergeActi on.MatchOnly;
this.miFile.Mer geIndex = 1;
this.miFile.Nam e = "miFile";
this.miFile.Siz e = new System.Drawing. Size(35, 20);
this.miFile.Tex t = "&File";

Regards,
John



Dec 16 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1459
by: Javier Alpizar | last post by:
Hi, I'm setting the Allowmerge property of both the parent and child menustrip but it doesn't work. I get two different menus instead of merged one when I open a child window. Am I missing something? Thank you.
5
5483
by: Alvo von Cossel I | last post by:
hi, i have a modern looking application without the cotrolbox-bar because i've created my own. i have a restore down button with an image that has a grey background. if the user has a different XP style then the button will look weird. how can i make the menustrip not change colour when the user of the PC changes their XP style? -- Alvo von Cossel I of Germany
0
1848
by: rellik | last post by:
Hi All, I've run into a problem with the MenuStrip control and any help would be greatly appreciated! The problem I've got is that when use a control derived from the MenuStrip class all MDI merge functionality breaks - each MDI child window is given it's own menu rather than the mdi parent. To repeat the problem just create a very simple dummy app that has standard
0
2020
by: academic | last post by:
I'm having a problem merging a ContextMenuStrip for a UserControl to the MenuStrip on the form containing the UserControl. I tried the following thinking that it is equivalent to cloning the ContextStrip menu Thanks for Any helpful suggestions?
0
2373
by: academic | last post by:
Using ToolStripManager.Merge(ToolStrip,ToolStrip) I've been able to merge a MenuStrip into a MenuStrip but never a ContextMenuStrip into a MenuStrip. From the docs it seems to me I should be able to.
1
4956
by: MyndPhlyp | last post by:
Newbie alert! VB 2005 Express. One MDIParent form and one regular Form. The MDIParent has the standard ToolStrip. The MDI Child Form has its own ToolStrip that is to be merged onto the MDIParent's ToolStrip. Sounds simple, right? I've gone through quite a few URLs that all pretty much say the same thing but I have yet to get this completely working. (Most of those URLs also seem to wander away from ToolStrip and instead go down the...
0
1654
by: Chris Peeters | last post by:
Hi, I have an MDI-application running with 1 MDI chilld showing in 'Normal'-WindowState, so NOT maximized. What I see is the MDI-main window showing its title bar, below that the menustrip with merged-menuitems and the MDI-child window 'floating' within the MDI-container just showing an icon + title in its title bar. So far so good. But when I maximize the MDI-child window ... what i see then is the
0
3203
by: =?Utf-8?B?Sm9obiBG?= | last post by:
Hello all, Is there anyway to stop a child form's minimize,maximize,close and system menu from automatically merging with the MDI parent's menustrip when you click the maximize button on the child? I'm able to catch the WM_GETMINMAXINFO message in WndProc and I can adjust the MinTrackSize, MaxTrackSize. I just can't for the life of me stop it from merging into the parent.
0
5053
by: kyungdongkim | last post by:
Hi, I have a dynamically generated MenuStrip following this example: http://www.codeproject.com/useritems/Dynamic_MenuStrip.asp Basically the menu strip allows users to save and load reports. The Load menu is to list all the saved reports. I need to refresh the Load menu after a new report is saved. Any help is much appreciated! Code:
0
8779
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8695
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9282
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9154
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
6614
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4445
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4708
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2499
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2089
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.