Description:
If I try to obtain the new value from DataController.Values within the OnEditValueChanged event handler it does not work since this property retrieves the previous values in every case. Is there a solution?
Answer:
Applies to:
When the OnEditValueChanged or OnChange event of a column or a row is fired, the new value is not yet posted to the DataController
's data array. An in-place editor is still active and you should obtain its editing value. This editor is passed as the Sender parameter of these event handlers. So, please use code similar to the following:
Delphiprocedure TYour_Form.Your_ColumnPropertiesEditValueChanged(
Sender: TObject);
var
Edit: TcxCustomEdit;
NewValue: Variant;
begin
Edit := Sender as TcxCustomEdit;
NewValue := Edit.EditingValue;
// Your other code is here...
end;
NOTE: When working with text editors (derived from TcxCustomTextEdit), you also can refer to their EditingText and Text
properties. However, using EditingValue gives you a more unified approach.
See also:
How to set a value of another Grid column during editing of a cell
How to change the selected text in the currently active editor in the Grid
How to get the corresponding View or column from within the in-place editor's event handlers
How to determine which row an in-place editor belongs to