20-08-2010, 04:20 AM
مشكله في استخدام Published Method في بيئة Lazarus IDE
هذه هي المحاوله
وهذه رساله الخطا
unit1.pas(54,20) Error: Incompatible types: got "Pointer" expected "<procedure variable type of procedure;Register>"
unit1.pas(61) Fatal: There were 1 errors compiling module, stopping
هذه هي المحاوله
كود :
unit Unit1;
{$mode objfpc}{$H+}{$M+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls;
type
{ TForm1 }
TForm1 = class(TForm)
Button1: TButton;
Edit1: TEdit;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
TNoParams = Procedure;
TMyClass = Class(TObject)
Published
Procedure GMsgbox;
End;
var
Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
Procedure TMyClass.GMsgbox;
begin
ShowMessage('Test Call Prucedure!');
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
end;
procedure TForm1.Button1Click(Sender: TObject);
Var
TmClass : TMyClass;
TMProc : TNoParams;
begin
TmClass := TMyClass.Create;
TMProc := TmClass.MethodAddress(Edit1.Text);
TMProc;
TmClass.Free ;
end;
end.وهذه رساله الخطا
unit1.pas(54,20) Error: Incompatible types: got "Pointer" expected "<procedure variable type of procedure;Register>"
unit1.pas(61) Fatal: There were 1 errors compiling module, stopping
Delphi Programmer

