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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Keypresses lost when typing in a fresh grid

Thread ID:





55586 Feb 1,2007 11:22 AM UTC Feb 1,2007 05:15 PM UTC WinForms 1
Tags: GridControl
Christian Muirhead
Asked On February 1, 2007 11:22 AM UTC

Hello -

We've seen a problem with keypresses being lost when you first type into a cell. I can reproduce it in the following way:

* Create an application with one form containing a GridControl with ActivateCurrentCellBehavior set to DblClickOnCell.

* Run the application, click on a cell and type several letters very quickly. The first letter appears in the cell once the edit textbox appears, a number of the next letters typed are lost, and then the rest of them go into the cell's textbox.

This only happens the very first time you type into the grid after the application starts - I never see dropped characters after the first time.

I've got a minimal project that will show what I'm talking about if it's unclear.

In investigating this, I've set up a pair of handlers - one on the grid.KeyDown, and one on the CurrentCell.Renderer.TextBox.KeyDown (hooked up during CurrentCellStartEditing). What appears to happen is that the first few key presses go to the grid KeyDown handler, and then at some point they start being sent to the textbox instead - the character from the first grid KeyDown event appears in the textbox, but the subsequent presses before the switch to the textbox's KeyDown handler seem to be dropped.

I can work around this problem by saving up all the keys that reach the grid's KeyDown handler, and injecting them into the cell textbox if I detect that some characters have been dropped, but it's pretty messy (particularly converting Keys to corresponding characters - does anyone have a clean way of doing this?).

It seems like this is happening because the grid is creating the edit textbox when it's first requested - so it takes longer when the first typing occurs, and that's why characters are dropped (it doesn't happen when the activation behaviour is single click, because it's created on the click, rather than waiting for typing). A better workaround might be to get the grid to create the textbox ahead of time - I've tried moving to 1, 1 and doing a BeginEdit/EndEdit or an Activate during the app's initialisation, but neither of these seem to do it.

Is there any way to have the grid create the textbox ahead of time, or queue up all the characters it receives in this way, rather than just the first one? Has anyone else seen this behaviour?


Administrator [Syncfusion]
Replied On February 1, 2007 05:15 PM UTC

Hi Christian,

We need more information to analyze your problem. What version of the grid and .Net framework are you using? Also what are the events you are handling? I don't see the problem in 4.4. I tested this problem in the attached sample

This sample sets the ActivateCurrentCellBehavior property to GridCellActivateAction.DblClickOnCell.

Do you see the behavior in this sample too?

Thanks for your patience.

Best Regards,

Note :

The reason for skipping the first keychar in GridTextBox.KeyPress event is that CurrentCell is not activated at this moment( renderer doesn't get the focused) while clicked on the cell(bcoz ActivateCurrentCellBehavior property to GridCellActivateAction.DblClickOnCell).


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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