{主窗口单元}
unit Main;

interface

uses
……{略去其他内容}
procedure Table1BirthdayGetText(Sender: TField;
var Text: String;DisplayText: Boolean);
procedure Table1BirthdaySetText(Sender: TField;
const Text: String);
private
{ Private declarations }
public
{ Public declarations }
……{略}
implementation

{将自定义的单元包含进来}
uses DBDateEditMaskTrans;

{$R *.DFM}
……{其他过程略}
procedure TForm1.FormActivate(Sender: TObject);
{设置一个日期型字段的输入掩码,
可以放到TField字段定义中。}
begin
  Table1.FieldByName(Birthday).EditMask:=
9999年99月99日;1;_;
end;

procedure TForm1.Table1BirthdayGetText(Sender:
TField; var Text: String;DisplayText: Boolean);
begin
  DateFieldGetText(Sender,Text);
end;

procedure TForm1.Table1BirthdaySetText(Sender:
TField; const Text: String);
begin
  if DateFieldSetText(Sender,Text)=False then
    Abort; {转换不成功,日期非法}
end;

end.