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 01:18 PM UTC

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


JS [email protected] July 11, 2005 02:35 PM UTC

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 03:45 PM UTC

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.
Up arrow icon