Recommended MDI toolbar merging architecture...

Bars for Windows Forms Forum

Posted 16 years ago by Kelly Leahy - Software Architect, Milliman
Version: 2.0.96
Avatar
We've just made the switch from Infragistics docking and toolbars to your controls due to issues we were having with theirs and our satisfaction with the SyntaxEditor control and your support there...

Anyway, I'm trying to rearchitect my MDI application to make use of your controls and I'm having some trouble figuring out the best way to design it for merging menus and MDI toolbars.

With infragistics, this was easy (one of the few things that was :)), but with your controls there doesn't seem to be any automatic merging of the controls.

I'm trying to figure out how best to make this as transparent as possible in my windows, so that I don't have a lot of interdependencies in my code (between my host window and my hosted windows).

In my old architecture, the way it worked was that toolbars that existed in the MDI child windows were automatically added to the host window's toolbar docking areas. Also, in 'adding' these toolbars, they were actually merged by name.

I've found the BarManager.Merge functionality and it seems that it can merge toolbars from the MDI child into the MDI parent, if the toolbar already exists in the parent. However, my parent could potentially be hosting MDI children that have their own custom toolbars. I'd like to be able to automatically merge these into the MDI parent (like VS2005 does with, for instance, the special toolbars for the XML editor, etc.), but I can't see a way to automatically do this (or even write generic code to handle this) in your framework.

Does such code exist? If not, do you have any plans to add code to automatically merge menus and toolbars from MDI children to the MDI parent? I think I could write this code if I needed to, but the complicated part would be making it behave correctly when toolbars need to 'disappear' due to them not being 'native' to the MDI parent. I'd hate to have to write this code myself, as it seems like infrastructure code that the UI studio should provide. :(

Anyway, I'll be happy to hear what you have to say on the subject.

Kelly Leahy Software Architect Milliman, USA

Comments (1)

Posted 16 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Kelly,

Just to be sure I understand correctly, the main issue here is that you want to have some new toolbars appear on the BarManager when an MDI child is active that aren't there by default. BarManager can merge one or more types of child controls into the docking toolbar/menu system however the issue is that the target toolbar must already exist. Does that sum it up correctly?

This gets a little tricky but perhaps what you could do is have a flag on your various MDI child types, to say whether they have a custom Image Edit toolbar or not. If an MDI window with that flag = true is activated and another global count variable (counting the number of current MDI windows that require such a toolbar) indicates the toolbar is not loaded yet (count = 0), then create a blank Image Edit toolbar, perform the Merge, and voila, it should work like you want. Then as more similar MDI windows are added that use that toolbar, increment the counter. When MDI windows are closed, decrement it, and when it reaches zero, remove that empty toolbar from Bar Manager after the Unmerge. You could do that for a number of toolbar types by using multiple flags/counter combinations.


Actipro Software Support

The latest build of this product (v24.1.0) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.