JavaScript samples. Cross-language programming.


using Forms, MyPascalUnit in "MyPascalUnit.pas";

f = new TMyForm()
try
{
  f.ShowModal()
}
finally
{
  f.Free()
}

MyPascalUnit:

unit MyPascalUnit;
interface
uses
  Controls, StdCtrls, Forms, Dialogs;
type
  TMyForm = class(TForm)
    Button1: TButton;
  private
    procedure Button1Click(Sender: TObject);
  public
    constructor Create;
  end;

implementation

constructor TMyForm.Create;
begin
  inherited Create(nil);
  Caption := 'My form created in Pascal';
  Button1 := TButton.Create(Self);
  with Button1 do
  begin
    Parent := Self;
    Caption := 'Click Me';
    Name := 'Button1';
    Left := 10;
    Top := 20;
    OnClick := Button1Click;
  end;
end;

procedure TMyForm.Button1Click(Sender: TObject);
begin
  ShowMessage('Hello!');
end;

end.


Copyright © 2006-2017 Alexander Baranovsky. All rights reserved.