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

2 problems when .Net controls placed in grid cells

Hi, 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. Syed Ibn-e-Ali.

1 Reply

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.

Loader.
Live Chat Icon For mobile
Up arrow icon