[Pas2js] is it possible to create GUi with no need to manually add the code to .html page

Mgr. Janusz Chmiel janusz.chmiel at volny.cz
Tue Aug 25 12:28:58 CEST 2020


This code produces .js file without compilation errors.
But unfortunately, WEB app contain only title Project1 and no button.
Why button have not been created on The WEB page?

program project1;

{$mode objfpc}

uses
  browserapp, JS, Classes, SysUtils, Web, webwidget, htmlwidgets;

type
  TMyApplication = class(TBrowserApplication)

    procedure doRun; override;
       private
     FMyPage: TWebPage;
     FMyButton: TButtonWidget;
   end;



procedure TMyApplication.doRun;

begin
  FMyPage:=TWebPage.Create(Self);
FMyButton:=TButtonWidget.Create(Self);
FMyButton.Parent:=FMyPage;
FMyButton.Text:='Start The code';


  Terminate;
end;

var
  Application : TMyApplication;

begin
  Application:=TMyApplication.Create(nil);
  Application.Initialize;
  Application.Run;
  Application.Free;
end.




More information about the Pas2js mailing list