Skip to main content

TcxCustomEditProperties.OnChange Event

Allows you to respond to display value changes in the editor.

Declaration

property OnChange: TNotifyEvent read; write;

Remarks

Handle the OnChange event to execute custom code in response to editor display value changes.

Event Occurrence

The OnChange event occurs every time the display value is changed in the editor. The event trigger depends on the editor type:

Text Box Editors
The OnChange event occurs on every TcxCustomEdit.Text property value change (every time a user adds or deletes a character when the editor has focus).
Image Editors
The OnChange event occurs in response to image changes.
Check Box Editors
The OnChange event occurs in response to check state changes.

Event Parameter

The Sender parameter provides access to the editor that raised the OnChange event. Cast the Sender parameter value to the corresponding editor class to access all public API members as shown in the following code example:

Code Example: Display the Text Box Value in the Application Form Caption

The following code sample demonstrates an OnChange event handler that displays a TcxTextEdit editor value in the application form caption:

uses
  cxTextEdit;   // Declares the TcxTextEdit class and related types
// ...

procedure TMyForm.cxTextEdit1PropertiesChange(Sender: TObject);
begin
  Caption := (Sender as TcxTextEdit).Text;
end;
See Also