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

Problem with ComboBox Cell

Hi I have a DBG bound to a dataview with a row filter that looks at the value of the combobox column. If the value of the combobox column is changed to anything but what is already selected then it is excluded from the row filter and drops out of the grid. This works as expected. However when I change the selected option in the top most row and it drops out of the grid the second row becomes the first and its combobox cell now has the appearance of the option I previously selected. If I click into the combobox cell the selected value changes back to the default. It is like the next combo box inherits the appearance of the one which has just disappeared. I know my description is pretty vague so I have attatched some screen shots to try and get my point accross a little better. Open in number sequence. Mark (vb.net) example_2122.zip

6 Replies

AD Administrator Syncfusion Team June 30, 2004 07:38 AM UTC

P.S. I would also like to know how change the row highlighting function so that it follows my cursor rather than highlighting the row that I click on. Or would this be better achieved by trapping the mouse co-ordingtes and changing the back color of the row I am hovered over? Thanks, Mark

AD Administrator Syncfusion Team June 30, 2004 08:39 AM UTC

picture 3) To force the change to be committed, you can try handling CurrentCellCloseDropDown, and in your handler call grid.CurrentCell.ConfirmChanges. If that does not do it, also try calling grid.CurrentCell.EndEdit followed by grid.Binder.EndEdit in the handler. picture 4) If you minimize and then maximize the screen, does the combobox draw ok. If so, then the problem is likely a redaw problem. To handle it, you might try calling grid.RefreshRange(GridRangeInfo.Row(grid.CurrentCell.RowIndex), true) at the end of the CurrentCellCloseDropDown event mentioned in 3. If that does not do it, you can handle RowsDeleted and try doing the grid.RefreshRange call there. For your last question, you might try setting grid.ListBoxSelectionMode = SelectionMode.One to see if that gives you what you want.

AD Administrator Syncfusion Team June 30, 2004 09:50 AM UTC

Clay Thanks for the reply. I have done some further testing and ir is not a redraw problem. I have refreshed the entire grid programtically and with code and even refreshed the effected row itself. None of these things has fixed the problem. I think its a problem with the combobox cell itself not re-drawing or caching the selectedIndex so that when the row disappears the next one in line inherits that position. Or maybe im just clutching at straws. Thanks for the tips on forceing the change to the datrow on CurrentCellCloseDropdown I will implement asap. The row highlight I would like to follow the mouse pointer as it traverses the grid without clicking to highlight a cell. Thanks Mark

AD Administrator Syncfusion Team June 30, 2004 10:41 AM UTC

Doing the code in CurrentCellCloseDropDown may affect the problem with the combobox not resetting itself. So, you might want to try that before you continue working on the combobox problem. To have the row selection change as move the mouse, then you would have to do this yourself in some events. Here is one way you could try it. Add a class member OldRow as integer to the form, and set it initially to -1. Then grid.MouseMove get the row of the current mouse position using grid.PointToRowCol (you can get th epoint from e.X and e.Y). Then compare the new row to the OldRow, and if they are different, save the OldRow in a temp variable, and set the OldRow to the new row. Then call grid.RefreshRange twice, once passing in the OldRow and once passing in the temp row. (This will refresh both the new and old row). Then finally, you can handle the grid.CellDrawn event, and in the event if e.RowIndex = OldRow, then call e.Graphics.FillRectangle and fill the e.Bounds with the grid.AlphaBelndSelectionColor.

AD Administrator Syncfusion Team June 30, 2004 11:13 AM UTC

Clay Thanks for the tips on the row highlight. I haven''t implemented any code on the dropdown box as yet and the refresh ideas havent solved my problem. The dropdown is still showing the wrong entry.

AD Administrator Syncfusion Team June 30, 2004 11:29 AM UTC

You should try the code in the CurrentCellShowingDropDown. It may handle this problem for you.

Live Chat Icon For mobile
Up arrow icon