From 8b489a0f24e5d6f42219ecccefcaaabdfab0bc0c Mon Sep 17 00:00:00 2001 From: michael Date: Tue, 4 May 1999 08:12:35 +0000 Subject: [PATCH] + Added bug #249 --- bugs/bug0249.pp | 59 +++++++++++++++++++++++++++++++++++++++++++++++++ bugs/readme.txt | 1 + 2 files changed, 60 insertions(+) create mode 100644 bugs/bug0249.pp diff --git a/bugs/bug0249.pp b/bugs/bug0249.pp new file mode 100644 index 0000000000..ef1a00f2ea --- /dev/null +++ b/bugs/bug0249.pp @@ -0,0 +1,59 @@ +program TestEvent; + +{$M+} + +type + TNotifyEvent = procedure( Sender: TObject ) of object; + + THost = class + FOnEvent: TNotifyEvent; + procedure SetOnEvent( Value: TNotifyEvent ); + public + constructor Create; + procedure Trigger; + procedure SayHello; + published + property OnEvent: TNotifyEvent read FOnEvent write SetOnEvent; + end; + + TDummy = class + procedure HandleEvent( Sender: TObject ); + end; + +constructor THost.Create; +begin + FOnEvent := nil; +end; + +procedure THost.Trigger; +begin + if @FOnEvent <> nil then + FOnEvent( Self ) +end; + +procedure THost.SetOnEvent( Value: TNotifyEvent ); +begin + FOnEvent := Value +end; + +procedure THost.SayHello; +begin + Writeln( 'Hello event' ) +end; + +procedure TDummy.HandleEvent( Sender: TObject ); +begin + THost( Sender ).SayHello +end; + + +var + Host: THost; + Dummy: TDummy; +begin + Dummy := TDummy.Create; + Host := THost.Create; + with Host,Dummy do + OnEvent := HandleEvent; // this is 57, 27 is ";" + Host.Trigger; +end. diff --git a/bugs/readme.txt b/bugs/readme.txt index 2617b11604..634b0eb312 100644 --- a/bugs/readme.txt +++ b/bugs/readme.txt @@ -342,3 +342,4 @@ bug0243.pp Arguments of functions are computed from right to left this bug0244.pp nested procedures can't have same name as global ones bug0245.pp assigning pointers to address of consts is allowed (refused by BP !) bug0246.pp const para can be changed without error +bug0249.pp procedure of object cannot be assigned to property. \ No newline at end of file