again coming back to the CurrentCellChanged Event as I have already posted in the Thread http://www.syncfusion.com/forums/message.asp?MessageID=1795.
I have continued playing around a bit with catching Cell Data changes immediately when they take place. I have tried it especially with the following CellTypes: TextBox, CheckBox, ComboBox, MonthCalendar.
It seems strange to me because, I can collect the actual data having been entered either in different places or only after I Deactivate(false) the cell in question (MonthCalendar).
If someone here could point me to a generic method of reading the CurrentCell's value from within the CurrentCellChanged() Event handler, I would really appreciate it. As noted in my other post I think it would make sense to have the current/new value available in the Renderer's CellValue property the time the Event Handler is entered.
But maybe it's just me who is missing anything here, maybe use a different event?!
Thanks for your help
ADAdministrator Syncfusion Team December 5, 2002 10:07 AM
CurrentCellChanged is raised when changes were made in the current cell while in editing mode. Immediately saving this changes as a cell value is not an option in most grid scenarios because it is only a temporary state of the edited cell. Before the cell value can be stored in the underlying cell it needs to be validated. This validation should only occur when the user is satisfied with his text entry and ok's it.
You can force saving the data into the cell by calling CurrentCell.CommitChanges(). CommitChanges() will validate the cell contents and store the value in the cell style. The cell renderer will neither be deactivated nor loose focus.
On a more general note: At the time CurrentCellChanged is raised the state of the current cells ControlValue is up to the specific cell editor. Optimal case will be that all cells save the CurrentCell.ControlValue based on the current text before CurrentCellChanged is raised, but it cannot be guaranteed that each cell renderer will do that. Most accurate is ControlText. It will return the text that is displayed in the cell but ControlValue must be explicitly generate by the renderer (and is only of use when you want to extend the cell type). We will try to make all our cell editor do that and generate a CurrentCell.ControlValue before CurrentCellChanged is raised in future when approbriate (e.g. it definitely makes sense for the combobox DisplayMember/ValueMember pair).
ADAdministrator Syncfusion Team December 5, 2002 10:36 AM
BTW - do you have source code? I yes, if you are interested just open a direct trac incident and I can mail you a corrected combobox renderer that will set the value before CurrentCellChanged is raised and I can also look at other renderers.
KIKai IskeDecember 5, 2002 10:28 PM
> BTW - do you have source code? I yes, if you are interested just open a direct trac incident and I can mail you a corrected combobox renderer that will set the value before CurrentCellChanged is raised and I can also look at other renderers.
I think I will first try to go down the CommitChanges() path and will extract the actual value after that. I assume it is safe to call CommitChanges() in CurrentCellChanged.
Thanks for the thorough explanation you have given me. Sheds a bit of light onto things and I'm looking forward to the changes being applied to make things consistent, where possible.