脚本事件处理函数出错:unit1.pas{32}:incompatible types:‘tnotifyevent’and'string'
下面是源码:
var
b: TButton;
Form1: TForm;
procedure ButtonClick(Sender: TButton);
begin
ShowMessage(Sender.Name);
end;
begin
b := TButton.Create(Form1);
b.Parent := Form1;
b.OnClick := @ButtonClick; // same as b.OnClick := 'ButtonClick'
b.OnClick := nil; // clear the event
end.
刚接触delphi 实在解决不了 求各位解决啊!!!
脚本
------解决方案--------------------
procedure ButtonClick(sender:TObject);
b.OnClick := Self.ButtonClick