Perşembe, Temmuz 05, 2018

Catch the error of validation of TMaskEdit

type
   TMaskEdit = class(Vcl.Mask.TMaskEdit)
   protected
      procedure ValidateError; override;
   end;

   TForm1 = class(TForm)
      .
      .
      procedure FormCreate(Sender: TObject);
      .
      .

.
.
.

{ TMaskEdit }
// All TMaskEdits in your form will use this procedure.
procedure TMaskEdit.ValidateError;
begin
   try
      inherited; // Original ValidateError
   except
      // Validation error occurred!
      Self.Clear;
      // I preferred clear the text.
      // If you want you can prefer show any message.
   end;

end;

Hiç yorum yok: