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

using ENTER key on a caption row

Hi...

I have created an editable cell in a GroupCaptionSummaryCell row. After the user types in a value and hits the ENTER key, the caption row expands/collapses. Is there anyway to disable the expand/collapse behavior when hitting the ENTER key?

Thanks,

eric

3 Replies

AD Administrator Syncfusion Team October 9, 2006 04:48 AM UTC

Hi Eric,

Try this code to handle the Enter Key behavior in a grid.

//Main Table in a grid
this.gridGroupingControl1.TableControl.WantEnterKey = false;

//Any tablecontrol in a Grid.
this.grid.GetTableControl("TableName").WantEnterKey = false;

Let me know if this helps.

Best Regards,
Haneef


EW Eric Weber October 9, 2006 06:57 PM UTC

I added this code, and it certainly does disable the ENTER button.

Now, after I type a value into the cell and hit the ENTER button, nothing happens. I tried catching the event in the TableControlKeyUp event, but it didn''t fire.

Prior to adding the WantEnterKey code, the enter key was firing the TableControlCurrentCellValidated event, and this is where I had my validation/rollback code.

Any suggestions?

thanks,

eric


AD Administrator Syncfusion Team October 10, 2006 11:07 AM UTC

Hi Eric,

You can use the TableControlCurrentCellControlKeyMessage event to detect the Enter Key when the currentcell is in EditingMode. Here is a code snippet

//Form load...
this.grid.TableControlCurrentCellControlKeyMessage +=new GridTableControlCurrentCellControlKeyMessageEventHandler(gridControlKeyMessage);

private void gridControlKeyMessage(object sender, GridTableControlCurrentCellControlKeyMessageEventArgs e)
{
Keys keyCode = (Keys)((int)e.Inner.Msg.WParam) & Keys.KeyCode;
if(keyCode == Keys.Enter )
{
Console.WriteLine("Enter Key pressed");
}
}

This event is called from current cell control''''s ProcessKeyMessage method and gives you a chance to modify the default behavior of this method. Be aware that this a very implementation-specific method and you should only handle this event if KeyDown,KeyUp,CurrentCellKeyDown or CurrentCellKeyUP events are not good enough.

Best Regards,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon