In a ultragrid when the cursor is placed inside a cell, on pressing the right mouse button, a standard contextmenu
containing items like "open IME", cut, copy, paste is displayed.
Is there a possibility to suppress that kind of menu in order to replaced it by a customized menu ?
like e.DisplayPromptMsg = false in the handler BeforeRowDeleted ? in order to suppress the standard delete confirmation dialog ??
You can set the ContextMenu property on the grid just like on any other control and your ContextMenu will replace the default one.
Hi Mike,
thanks for your suggestions. Unfortunately in the case of this contextmenu
(contains items: cancel,-, cut, copy, past, delete,-, select all, open IME)
it doesn't work. It seems to be a Windows XP menu.I tried to trace exactly what happened with spy++ there I can see that on pushing the right mouse buttonover der activated cell a WM_MOUSEACTIVATE event is fired.
But even when I override the WndProc handler no handler is called before the contextmenu is displayed.
protected override void WndProc(ref Message m) { //etc. if (m.Msg == WM_MOUSEACTIVATE) MessageBox.Show("test"); } No idea where I can suppress this menu?
I'm not sure I understand. Did you try what I suggested and simply apply a context menu to the grid? You don't need to do anything complicated with the WndProc. You just put a context menu on your form and go to the grid and set the ContextMenu.
Mike,
in the meantime I tried different things, the modification you recommended me too.
to set grid.ContextMenu while initialization, ..
especially to set the ContextMenu of the editor (WindowsForms10.EDIT.app.0.b7ab7b)
used in a grid cell (cell.EditorControl.ContextMenu)
It seem as there is no way to suppress or override this stanadard context menu ...?
Yours
Kagel
I don't know why you are having so much trouble with this. What version of the grid are you using?
I tried this out just now with v7.2. In CLR2, there is no longer a ContextMenu component available in the toolbox, so I placed a ContextMenuStrip on the form with my grid. Then I went to the grid's ContextMenuStrip property and assigned it the new, empty, ContextMenuStrip. When I right click on a cell now, nothing comes up since the context menu is empty.
You don't have to do anytning with the editor, and the EditorControl will have no effect at all.
This doesn't have anything to do with the ContextMenu.
FAQ:Mouse events such as MouseDown, MouseUp, and DoubleClick do not fire when the mouse is over a cell that is in edit mode.
hi,i have a similar issue, however i need to handle the right click event. however if you setup a blank context menu the right click event doesn't get fired. It works if you aren't focused on the control, but not if you are in edit mode in the control and you right click inside it.I am specificaly talking about textboxes here, not in grids, sorry i just saw where this post was made originaly.I've tried the mousedown and mouseclick events and both have their right click events masked if you have an empty context menu.Any ideas? Our whole app is run from right clicking to fire up pick forms.RegardsChris
A detail about this point should be mentionned:
I always tried to suppress the menu by assigning the following
ultraGrid1.ContextMenu = null; //>>>nok!
However if you assign a empty menu it works!
ultraGrid1.ContextMenu = menu; //ok!
Thank for your contributions
Hi Vitaly,
I'm pretty sure that your question is answered above more than once.
It you assign an empty ContextMenu to the grid control before you enter edit mode on the cell, then that context menu will be assigned to the editor control of the cell and thus nothing will show up.
I've got the same question as the original one was.
To reproduce the issue: right click the cell THAT IS IN EDIT MODE.
How to suppress this menu?
-Vitaly