Skip to main content

TcxCustomEdit.ValidateEdit Method

Validates the display value of an editor.

Declaration

function ValidateEdit: Boolean; overload;

Returns

Type
Boolean

Remarks

By entering a value into an editor, an end-user actually changes the display value (not the edit value). Before converting the display value to the edit value it needs to be validated. The ValidateEdit function performs validation, and if it succeeds, the function converts the display value to the edit value, and then returns True. Otherwise, False is returned and the edit value remains unchanged.

The ValidateEdit function performs necessary validations by making a call to the Properties.ValidateDisplayValue method. This method fires the Properties.OnValidate event, enabling you to customize (override) validation results.

If validation fails and True is passed as the ARaiseExceptionOnError parameter, the ValidateEdit function throws an exception (as if the evoRaiseException flag is set within the editor’s Properties.ValidationOptions property). Otherwise, no exception is thrown, which may be useful when you want to safely (quietly) validate the display value.

If validation succeeds, the editor’s Properties.OnEditValueChanged event is generated and a new edit value is assigned to the EditValue property.

See Also