I am using 22.214.171.124 Popupmenus manager.
When a popup menu is assigned to a Groupbox, it is coming up even though when I right click on a control with in the groupbox.
1. Open XPToolbarsAndContextMenus sample.
2. Set the "XPContextMenu on Popupmenusmnager1" to none for richttextbox1.
3. Select the "groupbox1" control and set the "XPContextMenu on Popupmenusmnager1" to popupmenu2 and run it.
4. Right click on the gradient label and notice that the popup menu comes up.
In my application, I have a databound grid. popup menu shows up on my grid as well. It should not do display it here.
Let me know what is happening.
Yes, that is how context/PopUp Menus will behave.
To overcome this, you could listen to the ParentBarItem's BeforePopUp and there you can look for the PopUpMenu's SourceControl and if is is say your grid, then you could cancel the PopUp.
AdministratorNovember 4, 2003 08:34 PM UTC
I added the BeforePopup event handler
It is printing "Control = groupBox1" when I right clicked on the gradient label. This is not right.
Can you check it out.
private void parentBarItem2_BeforePopup(object sender, System.ComponentModel.CancelEventArgs e)
Console.WriteLine("Control = " + popupMenu2.SourceControl.Name);
Arun SrinivasanNovember 6, 2003 09:12 PM UTC
Sorry, the SourceControl will return the original control to which the PopupMenu was associated.
In order to prevent the Context Menu from showing up when you right click on the grid or any other Child control, you need to assign a dummy context menu.
In the XPContextMenusAndToolBars sample, you need to add another PopUpMenu and associate it with the gradientlabel. Now if you right-click the gradientlabel the context menu will not show up, wheras it will if you right click anywhere else in the groupbox.