Jump to content
Ian Branch

What am I missing here??

Recommended Posts

Hi Team,

I am trying to assign the AfterEdit event to a TTable.

I have this in the private area:

procedure jtAfterEdit(Sender: TOBject);

I have this in the DatamoduleCreate;

  JobTickets.AfterEdit := JTAfterEdit;

And this as jtAfterEdit:

procedure TdmC.JTAfterEdit(Sender: TOBject);
begin
  //
    JobTickets.FieldByName('UserID').AsString := AUD.UserID;
    lNewRecord := False; //    Specifically reset the flag.
  //
end;

Delphi tells me that "[dcc32 Error] dmCurrent.pas(861): E2010 Incompatible types: 'TDataSet' and 'TObject'" for this line:

JobTickets.AfterEdit := JTAfterEdit;

What have I missed pls?

 

Regards & TIA,

Ian

Share this post


Link to post

Just going by the error message JTAfterEdit might need a parameter of type TDataset rather than TObject.. No idea whether that's correct, I haven't done any database programming for years. But also: Shouldn't JTAfterEdit be a method rather than a procedure?

Share this post


Link to post

Tks Thomas. 

Changing "Sender: TObject" to "Dataset: TDataset" did the trick.

 

Regards & Tks again,

Ian

Share this post


Link to post

The signature of the event is documented:

 

https://docwiki.embarcadero.com/Libraries/en/Data.DB.TDataSet.AfterEdit

property AfterEdit: TDataSetNotifyEvent read FAfterEdit write FAfterEdit;

 

https://docwiki.embarcadero.com/Libraries/en/Data.DB.TDataSetNotifyEvent

TDataSetNotifyEvent = procedure(DataSet: TDataSet) of object;

 

Edited by Remy Lebeau

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×