[Pas2js] LFM-to-PAS on-the-fly

warleyalex warleyalex at yahoo.com.br
Tue Apr 10 15:10:50 CEST 2018


Mattias Gaertner wrote
> Why not simply open a browser on Run?

I sincerely didn't know that feature, I always launch the page manually :(
I usually make some edits in the project, press CTRL+F9 to recompile, switch
over to the chrome, F5 to refresh again, and then observe the changes.
Frequently, I have Developer Tools opened when I refresh the page.


Mattias Gaertner wrote
> The idea of TCompWriterPas is to write the .inc file when the form is
> saved, i.e. when the lfm is saved.

My poor mechanism to create the .inc files manually (LFM-TO-PAS): is
extract/read data from the current project .LPI file to get a list of all
forms created at the current project, and then just have to pass a
"FormName" parameter to the DFM2PAS method.
------------
  procedure DFM2PAS(aFormName: String);
  var
    StreamAsPasForm: TStreamAsPasForm;

  begin
    StreamAsPasForm:=TStreamAsPasForm.Create(nil);
    try
      StreamAsPasForm.FormName :=
TWebFormClass(GetClass('T'+aFormName)).Create(nil);
      if assigned(StreamAsPasForm.FormName) then
      StreamAsPasForm.WriteComponents(StreamAsPasForm.FormName);
    finally
      StreamAsPasForm.FormName.Free;
      StreamAsPasForm.Free;
    end;
  end;
------------
About generating straightforward the {%formName%}.lfm.inc files when form is
saved it sounds a great trick, but I can't find a way to do this from the
LazarusIDE.


Mattias Gaertner wrote
> Are you trying to convert an existing Delphi project to a webapp? 

No, this is my pet project, I've already converted some TMS Web Core
components from the emitted javascript to use on the on the Lazarus IDE: 

TLabel, TEdit, TButton, TComboBox, TMemo, TListBox, TSpinEdit, TCheckBox,
TPaintBox, TImageControl, 
TPanel, TSplitter, TGridPanel, TSpeedButton, TToolBar, TDBEdit, TDBLabel,
TDBSpinEdit, TDBMemo, TDBNavigator, TMessageDlg, TClientDataSource,
TClientDataSet.




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


More information about the Pas2js mailing list