[Pas2js] Remove unwanted form properties

warleyalex warleyalex at yahoo.com.br
Sun Apr 8 16:48:12 CEST 2018


Now, the idea is create 
fully functional project with multiple "WebForms". 

In a pas2js WebApplication we can have multiple WebForms. Assuming "WebForm"
is basically a lazarus "form unit" with an associated HTML page. This
TWebForm inherits from the TForm. We I use the TCompWriterPas to mimic the
"component-to-code" it spills the following output: 

  Name:='Form1';
  Left:=350;
  Height:=480;
  Hint:='Form1';
  Top:=0;
  Width:=640;
  Caption:='Form1';
  ClientHeight:=480;
  ClientWidth:=640;
  LCLVersion:='1.9.0.0';
  with WebLabel1 do begin
    Name:='WebLabel1';
    Left:=64;
    Height:=13;
    Top:=232;
    Width:=33;
    Caption:='-Label-';
    ParentColor:=False;
    TPasStreamAccess(TComponent(WebLabel1)).SetParentComponent(Self);
  end;

Now I was stuck on how to prevent TCompWriterPas to emit these unwanted
properties, for instance:
-->  ClientHeight
-->  ClientWidth
-->  LCLVersion

I think I won't use the LCLVersion property in a pas2js web application.




Any idea how to prevent some properties
  ClientHeight:=480;
  ClientWidth:=640;
  LCLVersion:='1.9.0.0';



> As 
> I was stuck on this “Plan A”, I will try the plan B, which is a simple
> menu 
> button to call DFMTOPAS manually, this DFMTOPAS method is 
> (component-to-code) will translate ALL "instantiated" and "unassigned"
> forms 
> as well in the current project to pascal code, then I will add this 
> directive. 

What are "instantiated" and "unassigned" forms? 

 

> procedure TForm1.LoadDFMValues; 
> begin 
>   inherited; 
> { $I Form1.lfm.inc } 
> 
> //{ $I %form% } 
> 
> end; 
> 
> Any thoughts on this.

Note that a LFM might need units, not in the uses clause. The IDE only 
adds the units for the used component classes, not for the used 
property values. So compiling might fail. 




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


More information about the Pas2js mailing list