AD
Administrator
Syncfusion Team
March 30, 2004 12:20 PM UTC
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\2.0.3.0\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\2.0.3.0\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\2.0.3.0\Grid\Samples\In Depth\DropDownFormAndUserControlSample, shows two ways you can dropdown a usercontrol or a form from a cell.