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

Custom Column Style

If you take the combobox column style from the datagrid faq and replace the combobox with a button or another textbox and then fix up the code to compile and run, there will be a problem. When tabbing into the column in question, the focus will enter the column on the tab key press, and move on to the following column on the tab key up. This is obviously not what is desired. The reason I ask is that I wrote my own databound combobox control (because the Winforms one stinks - can't turn off the border,...), but when I use it in the grid like is done with the combobox example in the datagrid faq, I get the behavior described above. Further investigation shows that I get that behavior with just about any control (button, textbox) except the raw combobox. Any ideas?

5 Replies

JO john May 12, 2004 06:41 AM

Here's more for the conundrum (sp?). I created my own custom column style instead of deriving from the textbox one. All seemed to be working, until I added a call to Focus() on my custom combobox control from within the Edit method. Suddenly the erroneous tab behavior is back. Why would calling Focus() on my control cause the focus to move to the next control? Anybody? I think I'm going to have to write my own datagrid. There's too much magic going on here, and nobody has any answers.


JO john May 12, 2004 08:22 AM

Nevermind. I just needed to eat the WM_KEYUP message in WndProc inside my combobox. It seems the datagrid is doing something funky on the keyup for the tab key. Arrow keys don't have the problem. Funny that this solution is the same as the one for a different problem related to tabbing and using a normal combobox in the grid. To sum up: for every control that you want to use in the datagrid (via your own DataGridColumnStyle or from a derived one), if you need to set focus to your control while tabbing through the grid (for keyboard input), you need to eat the WM_KEYUP message for at least the tab key in your control.


NA nadeem May 27, 2004 02:07 AM

I have also used the databound combobox data grid control .but i cannot updata the database through it.can some one help me . can john send me or post your code. thanks


SK Sangeeta Kapoor July 19, 2005 11:33 AM

How do you eat the keyup. I have a subclassed datagrid and have overriden the wndproc sub - but can''t seem to get it to eat the keyup - can you provide some sample code please?


AD Administrator Syncfusion Team July 19, 2005 02:55 PM

I keep seeing instructions to eat the WM_KEYUP event. I am doing this exactly as described everywhere on the internet. I have even cut and pasted in the subclassed combobox code directly and tried it. IT DOES NOT WORK. If I set break points at the "return" statement after checking for the WM_KEYUP message, I see that the WM_KEYUP message is NEVER ever delivered to the ComboBox. Anyone have a suggestion? >Nevermind. I just needed to eat the WM_KEYUP message in WndProc inside my combobox. It seems the datagrid is doing something funky on the keyup for the tab key. Arrow keys don''t have the problem. Funny that this solution is the same as the one for a different problem related to tabbing and using a normal combobox in the grid. > >To sum up: for every control that you want to use in the datagrid (via your own DataGridColumnStyle or from a derived one), if you need to set focus to your control while tabbing through the grid (for keyboard input), you need to eat the WM_KEYUP message for at least the tab key in your control.

Loader.
Live Chat Icon For mobile
Up arrow icon