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

Handling KeyUp Event in the Form

I have an issue where I need to implement keyboard shortcuts for form controls (buttons) using the the Control Key (eg Ctrl + F4). My problem is that even though I have set KeyPreview = true for my form all I get back for the KeyUp event is the Control Key Up when I do Ctrl + F4, when the syncfusion grid has focus. When any other controls have focus I get, as expected, the F4 up with the KeyEventArgs property control = true. Is it possible to get the Syncfusion grid to give me the event F4 KeyUp with Control = true. Many thanks, Mike

2 Replies

AD Administrator Syncfusion Team April 1, 2004 09:17 AM UTC

Is the problem only when the grid has an actively editing current cell? When I tried a little sample, as long as the currentcell control did not have the input focus, pressing ctl+F4 was got to the Form1_KeyUp with the parameter set as you descibed above, e.COntrol being true. Is this what you see? Now with the embedded cell control having input focus, then the embedded control has control of the keys, and they are not getting passed back to the form. One way you can handle this is to subscribe to the grid''s gridControl1_CurrentCellKeyUp event, and check e.Control && (e.KeyCode == Keys.F4) there. You could even call your form''s keyup handler at that point. To avoid the form''s keyup being called twice when the current cell was not editing, the code includes a ckeck for this case.
private void gridControl1_CurrentCellKeyUp(object sender, KeyEventArgs e)
{
	if(e.Control && (e.KeyCode == Keys.F4) && this.gridControl1.CurrentCell.IsEditing)
	{
		this.Form1_KeyUp(sender, e);
	}
}


MB Michael Beecham April 1, 2004 10:01 PM UTC

Thankyou for the response. I really hoping there was a was just a flag I could set. I guess I''ll have to go for that solution. Many thanks for taking the time to respond. Mike

Loader.
Live Chat Icon For mobile
Up arrow icon