Board index » delphi » TDataset ... assign an Event

TDataset ... assign an Event

Goal: I want set to a TTableAfterInsert my procedure to show a message

this is my code

Var
   aTable : TTable;

procedure MyInsert;
begin
   ShowMessage('Hi');
end;

I don't have this on a Form
I have on a unit

I want assign my procedure on TDatasetEvent. on insert, or delete, etc.
On runtime...

Tanks on Advance.

 

Re:TDataset ... assign an Event


Quote
> this is my code

> Var
>    aTable : TTable;

> procedure MyInsert;
> begin
>    ShowMessage('Hi');
> end;

First, your declaration is wrong. It has to be:

procedure MyInsert (Dataset: TDataset);
begin
  ShowMessage ('Hi');
end;

You assign this via saying this:

Table1.OnAfterInsert := MyInsert;

Maybe you've to say Unit2.MyInsert...

Helge.

Other Threads