fastscript例子一
fastscript例子一
unit Unit1;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes
, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, fs_ipascal, fs_iformsrtti,
fs_iinterpreter;
type
TForm1 = class(TForm)
Memo1: TMemo;
Button1: TButton;
fsScript1: TfsScript;
fsPascal1: TfsPascal;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
{ 脚本
procedure btnclick(sender: tobject);
begin
showmessage('hello');
end;
begin
form1.button1.onclick:=@btnclick;
end.
}
procedure TForm1.FormCreate(Sender: TObject);
begin
fsScript1.Clear;
fsScript1.Parent := fsGlobalUnit;
fsScript1.AddComponent(Form1);
fsScript1.Lines.Assign(Memo1.Lines);
fsScript1.Run;
end;
end.