TpaxScripter Demo. PAX Time.


unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  PaxScripter, StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    PaxScripter1: TPaxScripter;
    procedure PaxScripter1AssignScript(Sender: TPaxScripter);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

uses
  IMP_SysUtils, IMP_ExtCtrls, IMP_Controls, IMP_Graphics, IMP_Forms;

{$R *.DFM}

procedure TForm1.PaxScripter1AssignScript(Sender: TPaxScripter);
begin
  Sender.AddModule('main', paxBasic);
  Sender.AddCodeFromFile('main', 'script.txt');
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  PaxScripter1.Run;
end;

end.

script.txt

Imports SysUtils, ExtCtrls, Forms

Dim Form = New TForm(NULL)
Form.Caption = "PAX Time"
Form.Canvas.Font.Height = 50

Dim Timer = New TTimer(Form)
Timer.Interval = 100
Timer.OnTimer = AddressOf ShowTime

Form.Show

Sub ShowTime(Sender)
  Form.Canvas.TextOut 10, 10, DateTimeToStr(Now()) 
End Sub


Copyright © 1999-2006 VIRT Laboratory. All rights reserved.