Hi!
I have a top form with a toolbar Manager and below that mdi-forms.All MDI-Forms share similar Tools on the toolbar.Most of the Tools are button-Tools.Under some of this button-Tools there ar submenueitems.
This works fine as Long as the keys of the button-Tools are different.
If I have a button tol bDetails on more thant one toolbar the merging does not work anymore.The first MDI-Form has the correct System.Windows.Forms.ToolStripMenuItemsThe second MDI-Form gets the correct ToolStipMenuItems.
But when I now Change back to the first MDI-Form the bDetails Button-Tool Shows the same Menuitems as the second MDI
the Mergetypes are set to Replace. What I am doing wrong? Or does this not work with submenuitems?
TIA
Josef
HI!
Perfect - Thank you very much.
Hi Josef,
You can accomplish this by handling BeforeToolbarListDropdown. In this event, you can check to see if the user right clicked that particular popup tool. If so, cancel the regular context menu and call DropDown on the tool.
private void ultraToolbarsManager1_BeforeToolbarListDropdown(object sender, BeforeToolbarListDropdownEventArgs e){ if (e.Tool.Key == "PopupMenuTool1") { e.Cancel = true; (e.Tool as PopupMenuTool).DropDown(); }}
Please let me know if this works for you.
Hi Mike
Your are a great help for my Problem.
I changed to a PopupMenutool and the merging works fine now beetween the MDI-Forms.
I have only a small issue now.
The Button is a segmentedStateButton - so that I can click on it and get the click Event. If I click at the small arrow I get my Drop-downs and I can use them.
What I would like to add is a right-mouse click to open the Submenue because the Arrow is so small, that quite a few of my customers will have Trouble clicking on it.
We had the right mouse already in use. How can I do that.
Again many thanks for your professional help.
I'm working to reproduce this scenario in a small sample, but have not yet been successful. In the sample, I set up a main form with two child forms. The main form and the child forms each have ToolbarsManagers with a standard toolbar and different buttons on them. The child forms both have a "bDetails" tool. I wasn't sure how you were displaying the submenus, so I used a PopupMenuTool and added three buttons to each. The child forms both have a bDetails tool, but the menus are different.
In the sample, the toolbars seemed to merge with no issues. I always saw the correct menu for the active child form. I have attached my sample here. Would you be able to modify it so that the issue occurs? Alternatively, you can send me a new sample and I'll work with that.
We normally use the main form's MdiChildActivate event to respond to toolbar merging. You can handle this event and perform any necessary processing immediately after merging occurs. If you need to take any actions directly before a merge, you can override the OnMdiChildMerge method in the parent form's class and add code before the base call. I added some comments to the sample at these locations for convenience.
Please let me know if you have any questions.
Looks like my last reply was not posted.
Well the keys of the button-Tools are equal like bDetails and bDetails. If I understood the documentation correctly this should not be a Problem.
Anyway I did more tests in the meantime.
I rebuilt the Submenues on the form_activate Event - but still do not see any Change.
I clear the submenues from all button Tools and rebuild them but still nothing changes. The last added submenues stay on all MDI-Forms although the Top menue gets merged correctly (like before).
And yes the behaviour is correct for button Tools which have different keys.
Any Ideas how I can manually Change the Menuitems after Merging? I could not find an Event which might be usefull.
Regards