Alternatively...

  var
    DBEdit: TDBEdit;
  ...
    if FormEditContact.Visible /*and Assigned(Sender)*/ then
    begin
      Assert(Assigned(Sender));
      DBEdit := Sender as TDBEdit;
      DBEdit.DataSource.Edit;
      DBEdit.Field.AsInteger := FormEditContact.ADOTable1.FieldValues['ID'];
    end else
    begin
      ShowMessage('Please select a contact first');
      FormEditContact.Show;
    end;


-Andreas

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:owner-delphi@;delphi.org.nz]On
Behalf Of Steven Knight
Sent: Thursday, 14 November 2002 13:41
To: Multiple recipients of list delphi
Subject: RE: [DUG]: Name of the calling control


Thanks guys, probem solved, here is resulting code:

    if FormEditContact.Visible then begin
      TDBEdit(Sender).DataSource.Edit;
      TDBEdit(Sender).Field.AsInteger :=
FormEditContact.ADOTable1.FieldValues['ID'];
    end else begin
      showMessage('Please select a contact first');
      FormEditContact.Show;
    end;


Steven Knight
Environment Canterbury

-----Original Message-----
From: Paul Mckenzie [mailto:paul@;smss.org.nz]
Sent: 14 November 2002 10:20 am
To: Multiple recipients of list delphi
Subject: Re: [DUG]: Name of the calling control


TWinControl(Sender).Name

Regards
Paul McKenzie
Analyst Programmer
SMSS ltd.

----- Original Message -----
From: "Steven Knight" <[EMAIL PROTECTED]>
To: "Multiple recipients of list delphi" <[EMAIL PROTECTED]>
Sent: Thursday, November 14, 2002 10:11 AM
Subject: [DUG]: Name of the calling control


> Please help me over a mental block.
>
> I want to create a general purpose procedure to update the data associated
> with a DBText control.
> It is activated by double click on the control. A number of controls share
> the same double click event.
>
> How do I refer to the control that the double click originated from?
>
> Steven Knight
>
>
> Help with home heating? Find out more:
http://www.ecan.govt.nz/Air/clean-air-now/chp-update.html
>
>
>
> **********************************************************************
> This email and any files transmitted with it are confidential and
> intended solely for the use of the individual or entity to whom they
> are addressed. If you have received this email in error please notify
> the system manager.
>
> The contents of this email and any attachments are not formal
> policy of Environment Canterbury, unless otherwise stated.
> **********************************************************************
>
> --------------------------------------------------------------------------
-
>     New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
>                   Website: http://www.delphi.org.nz
> To UnSub, send email to: [EMAIL PROTECTED]
> with body of "unsubscribe delphi"
> Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/


---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/


Help with home heating? Find out more:
http://www.ecan.govt.nz/Air/clean-air-now/chp-update.html



**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

The contents of this email and any attachments are not formal
policy of Environment Canterbury, unless otherwise stated.
**********************************************************************

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/

Reply via email to