[Pas2js] JComponents

warleyalex warleyalex at yahoo.com.br
Fri Nov 2 23:58:15 CET 2018


This is a experimental pas2js project, there are 4 forms. At the 4th form, we
drag n' drop a native visual TButton component, both runtime and design
worked.
-----------
jComponents Framework:
https://github.com/pas2js/pas2js.github.io/blob/master/master/projLForms/jcomponents.pas

LIVE PREVIEW: https://pas2js.github.io/master/projLForms/index.html

-----------
unit UForm4;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, Types, JS, Web,
  JComponents, uWButton
  {Forms, Controls, Graphics, Dialogs};

type

  { TForm4 }

  TForm4 = class(TWForm)
    Btn1: TButton;
    procedure Btn1Click(Sender: TObject);
  private
    button1: TButton;
  protected
    procedure InitializeForm; override;
    procedure InitializeObject; override;
    procedure Resize; override;
    procedure LoadDFMValues; override;
  public

  end;

var
  Form4: TForm4;

implementation

{$R *.lfm}

procedure TForm4.Btn1Click(Sender: TObject);
begin
  console.log('TForm4.Btn1Click');
  Application.GoToForm('Form3');
end;

procedure TForm4.InitializeForm;
begin
  inherited;
  // this is a good place to initialize components
  console.log('TForm4.InitializeForm');
end;

procedure TForm4.InitializeObject;
  procedure Button1OnClick(sender: TObject);
  begin
    console.log('TForm4 button1 clicked');
    Application.GoToForm('Form1');
  end;

  procedure rolaPreta(aTime: TJSDOMHighResTimeStamp);
  begin
    console.log('Form4',  aTime);
    //console.log(Self);
  end;

begin
  inherited;
  console.log('TForm4.InitializeObject');

  button1:= TButton.Create(Self);
  button1.SetBounds(10, 30, 100, 50);
  button1.Caption:='Btn4';
//  button1.SetInnerHTML('Button1');
  button1.OnClick := @Button1OnClick;
  button1.ReadyExecute(@rolapreta);
end;

procedure TForm4.Resize;
begin
  inherited;
  console.log('TForm4.Resize');
end;

procedure TForm4.LoadDFMValues;
begin
inherited;
  {$I Form4.lfm.inc}
end;

end.
-----------






--
Sent from: http://pas2js.38893.n8.nabble.com/


More information about the Pas2js mailing list