unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, Mask;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
type
TMyMask=Class(TMaskEdit)
protected
procedure ValidateEdit;override;
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
{ MyMask }
procedure TMyMask.ValidateEdit;
begin
Showmessage('Invalid Input');
end;
procedure TForm1.Button1Click(Sender: TObject);
var
tt:TMyMask;
begin
tt:=TMyMask.Create(self);
tt.parent:=self;
tt.EditMask:='!99/99/00;1;_';
tt.SetBounds(50,50,200,50);
tt.Show;
end;
end.
当焦点离开tt时,讲坛出invaild提示