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.

using ENTER key on a caption row

Thread ID:

Created:

Updated:

Platform:

Replies:

50157 Oct 6,2006 11:55 AM Oct 10,2006 07:07 AM Windows Forms 3
loading
Tags: Grouping
Eric Weber
Asked On October 6, 2006 11:55 AM

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

Administrator [Syncfusion]
Replied On October 9, 2006 12:48 AM

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

Eric Weber
Replied On October 9, 2006 02:57 PM

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

Administrator [Syncfusion]
Replied On October 10, 2006 07:07 AM

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

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.

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.

;