Ticket A571
Visible to All Users

How to get a new value within the OnEditValueChanged or OnChange event handlers

created 21 years ago (modified 2 years ago)

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:

Delphi
procedure 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

Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.