全部博文(788)
分类:
2009-05-12 16:04:35
写个事件付值给它
procedure EditChange(Sender: TObject);
begin
showmessage(Tedit(Sender).text);
end;
var NewEdit:Tedit;
begin
NewEdit:=Tedit.Create(self);
NewEdit.Parent:=self;
NewEdit.SetBounds(10,20,50,21);
NewEdit.OnChange:=EditChange;
end;
楼上写的基本正确,但稍微有些问题:
procedure TForm1.EditChange(Sender: TObject);
begin
showmessage(Tedit(Sender).text);
end;
procedure TForm1.EditChange(Sender: TObject);
begin
showmessage(Tedit(Sender).text);
end;
procedure TForm1.Button1Click(Sender: TObject);
var NewEdit:Tedit;
begin
NewEdit:=Tedit.Create(nil);
NewEdit.Parent:=self;
NewEdit.SetBounds(10,20,50,21);
NewEdit.OnChange:=EditChange;
end;
delphi 学习群:31469235
加入请注明 csdn 字样