I'm using a custom control in a cell by setting the CellType to "Control" and setting the CellStyle.Control property.
The custom control is derived from a standard TextBox, but when the grid goes into Edit Mode for this cell, it stops all the cursor key presses from getting to the control. Is there any way round this so my control can handle the cursor keypresses (also Tab, Delete etc)?
ADAdministrator Syncfusion Team July 22, 2003 07:31 AM
You can catch the CurrentCellKeyDown event and explicitly handle the keys if your control is the current cell. The snippet below has a TextBox named box as a "Control" cell type, and these snippets moves the right and left arrow keys in the control.
But doing this would mean duplicating code that my control already should handle, as well as just the arrow keys, also escape doesn't go through (which I use as an undo edit feature) also copy & paste, selection of text by holding down shift, etc etc...
ADAdministrator Syncfusion Team July 22, 2003 11:56 PM
Then in your derived control class, expose a method (make it public) that allows you to effectively call your controls' OnKeyDown (which is protected). Then in the above handler just call this newly exposed method to let your control process any given key.