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

Keep the cursor in the same cell after pressing Enter key

Is that possible to keep the cursor in the same cell of the GridControl after pressing the Enter key? In my application, the GridControl contains parameters for a charts. If the user modifies a cell and presses Enter, he should see the changes in the chart. But if the cursor goes to another cell which corresponding to a different chart, the user would not see the change he made. Thank you very much for help. Jerry

3 Replies

AD Administrator Syncfusion Team July 11, 2005 08:18 AM

Try setting: this.gridControl1.EnterKeyBehavior = GridDirectionType.None; to see if that gives you want you need.


JS jsun@doble.com July 11, 2005 09:35 AM

The cursor stays in the same cell now, but the change for the cell is not "Entered", the event CurrentEditingComplete and KeyPress are not triggered. I will try the KeyUp event to catch the "Enter". Are there other ways to handle keep the cursor in the same cell? Thank you very much. Jerry >Try setting: > >this.gridControl1.EnterKeyBehavior = GridDirectionType.None; > >to see if that gives you want you need.


AD Administrator Syncfusion Team July 11, 2005 10:45 AM

You can try handling the CurrentCellControlKeyMessage and calling CurrentCell.COnfirmChanges there.
private void gridControl1_CurrentCellControlKeyMessage(object sender, GridCurrentCellControlKeyMessageEventArgs e)
{
	Keys keyCode = (Keys) ((int)e.Msg.WParam) & Keys.KeyCode;
	if(keyCode == Keys.Enter && e.Msg.Msg == 0x100) //WM_KEYDOWN
	{
		e.Handled = true; //no further processing of enter key
		this.gridControl1.CurrentCell.ConfirmChanges();
	}
}

Loader.
Live Chat Icon For mobile
Up arrow icon