ToolStripManager.Merge and .RevertMerge help please

M

MyndPhlyp

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 same illustration path
using MenuStrip. My problem is with ToolStrips, not MenuStrips.)

No problem with ToolStripManager.Merge(sourceToolStrip, targetToolStrip),
other than the fact that no matter what I do with the ToolStripButton
MergeAction and MergeIndex I can't seem to get the buttons to merge in the
middle of the target.

Calling ToolStripManager.RevertMerge(sourceToolStrip, targetToolStrip), on
the other hand, appears to have no effect.

In the MDI Child, the ToolStrip's AllowMerge and AllowItemReorder are set to
True. The individual ToolStripButtons are all set to Insert (or Append -
I've tried it both ways) with unique MergeIndex values (let's say they're
values from 51-55).

The MDI Child's New() subroutine simply calls:

ToolStripManager.Merge(Me.ToolStrip, MyParent.ToolStrip)

No problems there (other than the merged button order that is - they always
get tacked on the end of the target).

The MDI Child's FormClosing() subroutine equally simply calls:

ToolStripManager.RevertMerge(Me.ToolStrip, MyParent.ToolStrip)

Unfortunately the merged result is still displayed.

In the MDIParent, the ToolStrip's AllowMerge and AllowItemReorder properties
are also set to True. The individual ToolStripButtons are mostly default
(Append, -1) except for the last separator and Help buttons that have a
MergeIndex of 98 and 99 respectively.

The big question is how does one get merged ToolStrips unmerged?

The bonus question is how does one get ToolStripButtons to merge in the
middle of the target?
 
M

MyndPhlyp

MyndPhlyp said:
The MDI Child's FormClosing() subroutine equally simply calls:

ToolStripManager.RevertMerge(Me.ToolStrip, MyParent.ToolStrip)

Doh! Finally figured that one out. Had to reverse the order of the
ToolStrips in the parameter list.

Still trying to figure out how to get the ToolStripButtons of the source to
merge in the middle of the target though.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Merging toolbars 3

Top