procedure TForm1.myOnClick(Sender: TObject);begin//you codeend;var TempTedit:Tedit;beginTempTedit:=TEdit.create(self);tempTedit.OnClick := myOnClick;...end;