那看一下程序,在本程序中,表单上仅有一个按钮控件。
系统提示是:'TNotifyEvent' and 'procedure, untyped pointer or untyped parameter'。
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
procedure but1Click(var i: integer);
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
var but1: Tbutton;
i: integer;
begin
but1:=Tbutton.Create(self);
but1.Parent:=form1;
but1.Top:=100;
but1.Left:=100;
but1.Caption:='Test';
i:=3;
but1.onClick:=but1click(i); //编译到这里的时候提示为:Incompatible types: 'TNotifyEvent' and 'procedure,
//untyped pointer or untyped parameter'
end;
procedure but1Click(var i: integer);
begin
showmessage(inttostr(i)+#13+'sdf;asldjfk');
end;
end.