mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-05 14:48:18 +02:00
32 lines
420 B
ObjectPascal
32 lines
420 B
ObjectPascal
{ %opt=-vn -Sen }
|
|
{ %norun }
|
|
{$mode objfpc}
|
|
type
|
|
TForm = class
|
|
procedure OnClick;
|
|
end;
|
|
|
|
TNotifyEvent = procedure of object;
|
|
|
|
procedure TForm.OnClick;
|
|
begin
|
|
end;
|
|
|
|
|
|
procedure Test (aObject: TObject);
|
|
var
|
|
aForm: TForm;
|
|
aEvent: TNotifyEvent;
|
|
begin
|
|
if (aObject is TForm) then
|
|
begin
|
|
aForm := aObject as TForm;
|
|
aEvent := @aForm.OnClick;
|
|
aEvent();
|
|
end;
|
|
end;
|
|
|
|
begin
|
|
Test(nil);
|
|
end.
|