Skip to main content

TcxCustomEditProperties.ValidateDisplayValue(TcxEditValue,TCaption,Boolean,TcxCustomEdit) Method

Validates the specified display value.

Declaration

procedure ValidateDisplayValue(var ADisplayValue: TcxEditValue; var AErrorText: TCaption; var AError: Boolean; AEdit: TcxCustomEdit); virtual;

Parameters

Name Type
ADisplayValue TcxEditValue
AErrorText TCaption
AError Boolean
AEdit TcxCustomEdit

Remarks

The ValidateDisplayValue method is called before converting the changed display value to the edit value in the following cases:

  • When moving focus to another control;

  • When pressing the Enter key, if the ValidateOnEnter property is set to True.

The method validates the display value passed as the DisplayValue parameter. If the display value cannot be converted to the edit value, the ValidateDisplayValue method sets the Error parameter to True and assigns the ErrorText parameter as an error description.

If an editor specified by the AEdit parameter has an OnValidate event handler assigned, the ValidateDisplayValue method fires this event enabling you to customize (override) the validation results. In this instance, the ValidateDisplayValue method passes DisplayValue, ErrorText, and Error as parameters to the OnValidate event handler.

If the ValidateDisplayValue method or the OnValidate event handler sets the Error parameter to True, the display value is not converted to the edit value and the following takes place to indicate the error:

  • The system sound is played (provided that the BeepOnError property is set to True);

  • An exception is raised (provided that the evoRaiseException flag is set within the ValidationOptions property).

Refer to the ValidationOptions property description to learn how to customize the manner in which the editor handles and displays its validation errors.

See Also