I am having a problem adding a PopupMenuTool to an already existing PopupMenuTool. I am unable to post the code that I am using but I will try to explain.
I have an UltraWinGrid object (myWinGrid)
I have an UltraToolbarsManager object (mTBMgr).
I have a PopupMenuTool popMenu7 = new PopupMenuTool ("gridPopup").
- the popMenu7 PopupMenuTool contains a bunch of buttons
popMenu7.Tools.AddRange ( ToolBase[] { buttonTool40, buttonTool41, .....});
- the popMenu7 PopupMenuTool is added to the UltraToolbarsManager object
mTBMgr.Tools.AddRange ( ToolBase[] { button50, popMenu7 , button 51,.....} );
(All of this is logic is in the InitializeComponent method of my form)
I have a event handler to handle the OnMouseUp event for the grid (myWinGrid). Here is the code for that event
protected void myWinGridOnMouseUp(sender, e)
{
if (e.Button.Eqauls(MouseButton.Right)
PopupMenuTool contextMenu = mTBMgr.Tools["gridPopup"] as PopupMenuTool ;
PopupMenuTool newContext = new PopupMenuTool("Columns");
newContext.SharedProps.Caption = "Columns";
mTBMgr.Tools.Add(newContext );
contextMenu.Tools.AddTool("Columns");
contextMenu.ShowPopup();
}
When I run this code, the "Columns" popup menu is not displaying in the popMenu7 menu. If I step through the code and I examine the contents of the mTBMgr and popMenu7, the "Columns" popup menu exists in the Tools collection but it is not displaying.
We have 2 versions of Infragistics at our Company, version 8 (8.1.20081.1000) and version 10 (10.1.20101.1007). The code I have listed above works when I use version 8 of Infragistics but it does not work when I use version 10 of Infragistics.
Unfortunately I can not post any of the code. I find it really strange that the Tools collection is being populated correctly but is not being displayed. Do you have any suggestions on what to look at?
That's strange. I'm not sure what the issue could be. Can you post a small sample that reproduces it? I can't think of any other event that would be better to use.
Mike,
I added your code to a sample form and everything worked fine. But when I try to apply the same logic to my other GUI, the "Columns" popupmenu does not appear in the "gridPopup" popupmenu. I added some debug statements to the mToolbarsManager_BeforeToolDropdown method to see what is happening and it seems like the e.Tool property is being modified correctly (I popped up a messagebox listing the number of Tools in the e.Tool collection of the "gridPopup" popupmenu and the count shows that a new item was added). So the new PopupMenuTool is being added properly but it is not being displayed for whatever reason.
I am not exactly sure where to go from here. Can you think of any particular reason why the popupmenutool would not be displaying properly? Is there any other method/event that I can use to accomplish what I am tyring to accomplish?
A lot of changes have been made since then. My guess is there was probably a bug in 2007.1 where the toolbars manager was erroneously picking up some changes in the child but not all. It was probably fixed between then and now. I will contact DS about your open issue.
Thanks Mike,
this solved my issue. Maybe you can tell this your teammates :) At least the one who is responsible for my open issue.
But why is this necessary now in 2010.3? Because in 2007.1 I don't need to call RefreshMerge(). It just works. Maybe you can give me an explanation.
I did a short source diff between 2007.1 and 2010.3 and I saw that there was something regarding merging at PopupTool.cs. But I didn't dig deeper into it.