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
close icon

Standard Key Handlers?

Does the grid have already built-in handlers for common hot keys (CTRL-C,X,V,A, etc.) that can be turned on with one of the many "magic" properties or do I need to override OnKeyPress, and handle the key press event, respectively? If there is no such "magic" it would be a nice feature to have all common handlers available esp. since there is already a clip board handler class. Regards, Jens

2 Replies

AD Administrator Syncfusion Team November 29, 2004 10:13 PM UTC

The grid has support for copy, cut and paste throught ctl+C, ctl+X and ctl+V. It does not support ctl+A. To handle other keys, you could use this event, but you would need to check e.Msg.Msg as the event is raised for both KeyUp and KeyDown.
private void gridControl1_CurrentCellControlKeyMessage(object sender, GridCurrentCellControlKeyMessageEventArgs e)
{
	Keys keyCode = (Keys) ((int)e.Msg.WParam) & Keys.KeyCode;
	if( 0 != (keyCode & Keys.ShiftKey) || 0 != (keyCode & Keys.ControlKey))
	{
		e.CallProcessKeyPreview = false;
		e.CallBaseProcessKeyMessage = false;
		Console.WriteLine(e.Msg.ToString());
		Console.WriteLine(keyCode.ToString());
	}
}


AD Administrator Syncfusion Team November 30, 2004 07:47 PM UTC

Great that works well. Even pastes correctly into an Excel spreadsheet. Now it would be nice to also support ctrl+A cuz then I wouldn''t have to do anything :) Thanks for your help. Jens

Loader.
Live Chat Icon For mobile
Up arrow icon