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.

Custom Column Style

Thread ID:

Created:

Updated:

Platform:

Replies:

13812 May 11,2004 12:20 PM Jul 19,2005 02:55 PM Windows Forms 5
loading
Tags: FAQ
john
Asked On May 11, 2004 12:20 PM

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?

john
Replied On 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.

john
Replied On 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.

nadeem
Replied On 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

Sangeeta Kapoor
Replied On 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?

Administrator [Syncfusion]
Replied On 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.

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.

;