We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Del Shortcut in popup menu firing during grid edit

Hi, I''ve got a popup menu defined with a delete bar item which has the shortcut set to Shortcut.Del Unfortunately the click event for this bar item is firing when I hit the delete key while editing text in a cell in the grid (which is not at all desirable). How can I prevent this from occuring? Thanks, Sue

5 Replies

AD Administrator Syncfusion Team December 9, 2004 02:44 AM

The only way I know to do this is to derive the grid and override ProcessCmdKey.
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
	if(keyData == Keys.Delete)
	{
		return false;
	}
	return base.ProcessCmdKey (ref msg, keyData);
}


SH Sue Harris December 9, 2004 02:18 PM

Is there any way in that override class to determine whether the grid has a Syncfusion XP context menu? Thanks, Sue


SH Sue Harris December 9, 2004 03:54 PM

Hi Clay, Unfortunately the ProcessCmdKey doesn''t seem to trigger in the instance of the popup menu shortcut firing when editing. It only triggers in the reverse situation (when I''m not editing), so apparently its firing on the cell controls ProcessCmdKey (which I doubt I can override them all). Do you have any further ideas? Thanks, Sue


AD Administrator Syncfusion Team December 9, 2004 06:32 PM

I tried it with a main menu item, and that worked OK for me. I did not try it with a ContextMenu. Can you post a sample showing what you are doing? As far as knowing what kind of menu is being used, are you usingteh grid.ContextMenu property? if so, you could text the typpe of that obejct.


SH Sue Harris December 9, 2004 08:36 PM

My apologies, I missed the piece of code in my base class that set the context menu of the renderer to the grids context menu. Commenting that line out fixed the problem. Thanks, Sue

Loader.
Live Chat Icon For mobile
Up arrow icon