I am using Essential Grid and developing my application in VB.Net. I have used "Control" cell type to have different .Net controls (like checked listbox,listbox, and combobox) in the grid cells. I am facing two problems in this case:
1. The controls requires two clicks to work e.g. the combobox shows drop-down if clicked twice. The first one to have focus on the control and second one to show drop-down.
2. If focus is on a checked listbox/simple listbox and then up or down arrow key is pressed, instead of changing the selected item in the list the grid changes focus to the cell above or below according to the arrow key pressed.
Any help will be highly appreciated.....Thanks in advance.
ADAdministrator Syncfusion Team March 30, 2004 07:20 AM
1) The GenericControl code does try to fire a fake left mouse click to avoid this problem, but there is no general solution that we could come up with. This will work in some situations (like if your control is a simple textbox), but not others (your control is a panel that holds several other controls). You will likely have to add special code to activate (and set states) for what ever control you want to have focus. For example, if you want to try to do this without deriving the cell control, then you might try handling CurrentCellControlGotFocus. There if e.Control is your control, then specifically set its state (drop it if it is a combobox or set the focus to a particular child control if it is a panel). If you get stuck trying to get this done for a particular control, then if you attach a small project using the control, maybe we can suggest something that would accomplish what you want.
2) Handling this will require that you derive the cell control. In the cell renderer class, you override ProcessKeyEventArgs, and there you process any keystrokes that you do not want the parent grid to handle. Normally, this will also require that you derive the actual control clas (like panel or checkedlistbox or ???), an dexposed a public method that came be uses in your ProcessKeyEventArgs override to pass along the keystrokes to the control itself. To see one example of this, you can look at the Syncfusion\Essential Suite\184.108.40.206\Grid\Samples\In Depth\GridInCells sample. That sample has a gridcontrol in teh cell of a parent grid. If teh cell grid has focus, the the arrow kys need to be ahndled by the cell grid and not the parent grid. The ProcessKeyEventArgs override facilitates this.
If you have 2030 installed, there are a couple of other samples that might be of interest to you. One is \Essential Suite\220.127.116.11\Grid\Samples\DataBound\RepeaterUserControlSample. It has code that forwards the left arrow and right to the embbeded control using a slightly different technique to forward these particular keys to the embedded control. The other sample, \Essential Suite\18.104.22.168\Grid\Samples\In Depth\DropDownFormAndUserControlSample, shows two ways you can dropdown a usercontrol or a form from a cell.