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.
Unfortunately, activation email could not send to your email. Please try again.

Problem with ComboBox Cell

Thread ID:

Created:

Updated:

Platform:

Replies:

15895 Jun 30,2004 02:37 AM Jun 30,2004 07:29 AM Windows Forms 6
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On June 30, 2004 02:37 AM

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

Administrator [Syncfusion]
Replied On June 30, 2004 03:38 AM

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

Administrator [Syncfusion]
Replied On June 30, 2004 04:39 AM

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.

Administrator [Syncfusion]
Replied On June 30, 2004 05:50 AM

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

Administrator [Syncfusion]
Replied On June 30, 2004 06:41 AM

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.

Administrator [Syncfusion]
Replied On June 30, 2004 07:13 AM

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.

Administrator [Syncfusion]
Replied On June 30, 2004 07:29 AM

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

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;