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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Allow Keys.Enter to pass through

Thread ID:

Created:

Updated:

Platform:

Replies:

8612 Nov 13,2003 09:31 PM UTC Nov 14,2003 05:06 PM UTC Windows Forms 2
loading
Tags: GridControl
Sean Greer
Asked On November 13, 2003 09:31 PM UTC

Using Essential Suite 1.6.1.8 I've set KeyPreview on the form that contains a GridDataBoundGrid to true and I'm kind of surprised that my override of ProcessDialogKey is not called when the grid is the active control. What am I doing wrong here? My goal is to be notified when Enter is pressed so that I can open another form to edit the current row. Thanks, Sean

Administrator [Syncfusion]
Replied On November 14, 2003 11:22 AM UTC

You can catch the keys in ProcessKeyPreview. You would want to check for the enter key and for the m.Msg value as this can possibly be hit multiple times (KeyDown, KeyPress, KeyUp).
protected override bool ProcessKeyPreview(ref Message m)
{
	bool enter = (((Keys)m.WParam.ToInt32()) & Keys.Enter) == Keys.Enter;
	if(enter)
	{
		Console.WriteLine(m);
	}
	return base.ProcessKeyPreview(ref m);
}
If you add a Windows Forms DataGrid to your form, you will also see that ProcessDialogKey is not hit for that control either. I think the reason is that the it is really the embedded controls like TextBoxes that have the input focus at this point.

Administrator [Syncfusion]
Replied On November 14, 2003 05:06 PM UTC

Try also setting grid.WantEnterKey = false; Stefan

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;