size : 1246 uploaded_on : Tue Jan 19 00:00:00 1999 modified_on : Wed Dec 8 14:03:33 1999 title : Determine sender org_filename : DetermSender.txt author : Matthias Thiel authoremail : matze@sj.com description : How to determine which item called procedure? keywords : tested : not tested yet submitted_by : The CKB Crew submitted_by_email : ckb@netalive.org uploaded_by : nobody modified_by : nobody owner : nobody lang : plain file-type : text/plain category : delphi-commoncontrols __END_OF_HEADER__ >Can anyone tell me wheter (and perhaps how) it is possible for a procedure >to determine which item called it? I am trying to write a procedure that is >called by 7 different TEdit objects but within my procedure I need to know >the contents of Edit.Text. The Sender parameter is the object that called the procedure. You can retrieve the component's name by using "TComponent(Sender).Name". And you can validate what type the component is of by using something like "if (Sender is TEdit)..." And in the object explorer you can assign the OnExit event of the single TEdits to one procedure. So, it is possible to react in only one procedure on the exits of more than one TEdit. For example: procedure TForm1.EditExit(Sender: TObject); begin {Maybe all of your directory edit fields are called something like ...Dir...} if pos('Dir',TComponent(Sender).Name)<>0 then begin if not DirExists(TEdit(Sender).Text) then ShowMessage('Directory does not exist!!'); end; {... and some TEdits for file names are called something like ...File...} if pos('File',TComponent(Sender).Name)<>0 then begin if not FileExists(TEdit(Sender).Text) then ShowMessage('File does not exist!!!'); end; end;