[Lazarus] A simple event problem in console program

Bart bartjunk64 at gmail.com
Tue Dec 15 23:32:20 CET 2015


On 12/15/15, Aradeonas <aradeonas at operamail.com> wrote:

>> procedure notievent(Sender: TObject);  begin    WriteLn('test');  end;

Create a class with a procedure notievent,simple as that.

type
  TDummy = class;
    procedure notievent(Sender: TObject);
  end;

....

var
  Dummy: TDummy;
begin
  Dummy := TDummy.Create;
  b := Tbook.Create;
  b.noti := @Dummy.notievent;
  b.Free;
  Dummy.Free;
end.

Something like that (untested code).

Or define a
type
  TNotifyProc = procedure(Sender: TObject);
(Which the will not be of type TNotifyEvent)

Bart




More information about the Lazarus mailing list