[Pas2js] Picture serialisation into Pascal

warleyalex warleyalex at yahoo.com.br
Mon Dec 10 11:37:59 CET 2018


Michael Van Canneyt wrote
> This is up for debate: you could actually write the image to file, and set
> an URL. By putting it in the Javascript you make the javascript bigger and
> take away the possibility of the browser to offload the request for the
> image.
> 
> I don't know what component you use for converting .lfm to pas. 
> But if you need these things, I think they are specific to the widgetset
> and a separate
> converter component is the answer.
> 
> Michael.

The LFM-TO-PAS mechanism comes from the "compwriterpas.pas" unit, written by
Mattias Gaertner.

It's available to download the package, we embedded the mechanism LFM-to-PAS
in a modified pas2jsdsgn.lpk (pas2js designer), to enable us using Helios's
visual widgets for pas2js.

DOWNLOAD link: 
https://www.dropbox.com/s/fxce1l52td1sbak/pas2js_widgets_designer.rar?dl=0

The component TWebImage should provide the user 2 mechanisms:
a) encode image base64; --> When you drop a visual TWebImage into designer
and load the "Picture" property to load a image, the embedded image, the
component serialization fails here.

b) using a URL;  --> this is working as expected!
--------
  with WebImage1 do begin
    Name:='WebImage1';
    Parent:=Self;
    Left:=16;
    Height:=90;
    Top:=16;
    Width:=90;
    URL:='picture.png';
    Picture.LoadFromFile(URL);
    Stretch:=True;
end;
----------------------------------

pas2js_widgets_designer.rar
================== 
it contains the: 
a) pas2js widgets lib; 
b) the lazarus widgets components, and 
c) the modified lazarus pas2jsdsgn.

Description
------------
i) copy the "lib" folder to the installation, for instance, 
.\pas2js-windows-1.0.4\packages\lib 

ii) make sure you modify the \bin\pas2js.cfg 
----------------------------------- 
# 
# Minimal config file for pas2js compiler 
# 
# -d is the same as #DEFINE 
# -u is the same as #UNDEF 
# 
# Write always a nice logo ;) 
-l 

# Display Hints, Warnings and Notes 
-vwnh 
# If you don't want so much verbosity use 
#-vw 

# Allow C-operators 
-Sc 

-Fu$CfgDir\..\packages\rtl 
-Fu$CfgDir\..\packages\fcl-base 
-Fu$CfgDir\..\packages\fcl-db 
-Fu$CfgDir\..\packages\fpcunit 
-Fu$CfgDir\..\packages\lib 

#IFDEF nodejs 
-Jirtl.js 
#ENDIF 

# end. 
----------------------------------- 
iii) The "pas2js" is the modified the original pas2js widget package 
(pas2jsdsgn.lpk), we use this package to create new pas2js web app with 
visual forms. You can view this package at "lazarus/components/pas2js", just
rewrite this 
directory and reinstall this pacakge. 

iv) You also have to install this package "lazarus_pas2js_designer", to
enable us using the lazarus visual widgets.




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


More information about the Pas2js mailing list