I have a problem with the context menu on my UltraWinGrid: it doesn't automatically disappear when the mouse is clicked on something other than the menu. The only way to close the context menu is a) press the Alt or Esc keys b) click on one of the context menu's entries or on a toolbar button or c) click on another window.
Other than this behaviour, the context menu functions normally.
Oddly, this problem is occuring on only one of our forms -- we use the same type of context menu on other forms without this problem. In order to rule out an odd design time setting I've tried deleting the UltraToolbarsManager and UltraGrid from the form, then adding them back from the Toolbox so that they both have the default settings. I've tried (temporarily) deleting all the event handler code for the the grid and UltraToolbar. I've changed all the runtime settings for the grid and toolbar to match other forms which don't have this problem. None of these changes fixed the problem.
So, I'm stuck. I can only assume that the cause is a setting or event handler for something else on the form, but I've run out of ideas.
Any idea what might prevent the context menu from automatically disappearing. Any suggestions on what else I can try to find the cause of the problem?
We are using an UltraContextMenu on all of our forms' grids, assigning it with a statement like:
ultraToolbarsManager1.SetContextMenuUltra(grid, "GridContextMenu");
Thanks,
Dan.
Hi Dan,
Are you showing the context menu manually in code? Or is it displaying automatically because you assigned it to the grid?
If you are showing in manually, then it may be an issue of the event you are using, Make sure you use MouseUp, not MouseDown.
This could also be a container issue. Are you creating the UltraToolBarsManager or grid in code, rather than placing it on the form at design-time? If so, make sure you add the grid control to the Controls collection of the parent form. ANd make sure you set the UltraToolbarsManager's DockWithinContainer property to the form.
Is this form a child of another form? If so, when you display the form are you specifying an owning form?
Hi Mike,
You were right about the cause being no owning form. The grid is on a child form that was displayed by the parent using frmChild.ShowDialog(). Changing that to frmChild.ShowDialog(this) fixed the problem.
Thanks!