Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / pas2js / 2019-07

Component Streaming implemented

4 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Michael Van Canneyt

Hello,

It's with great pleasure that I can announce that streaming of components now works in the classes unit. It has been committed to SVN.

The binary format is not 100% compatible to Delphi or FPC, but the intent is that once the binary form and text form can be converted, the delphi text .dfm can be converted to a binary form usable by pas2js.

The conversion from/to text form is not yet there, but I expect to implement this in the coming week.

Michael.

Reply by email

silvioprog
to Michael Van Canneyt
PM Michael Van Canneyt wrote 5 lines
Hello, It's with great pleasure that I can announce that streaming of components now works in the classes unit. It has been committed to SVN.

Great news!

The binary format is not 100% compatible to Delphi or FPC, but the intent

Show quoted text 10 lines
is that once the binary form and text form can be converted, the delphi text .dfm can be converted to a binary form usable by pas2js. The conversion from/to text form is not yet there, but I expect to implement this in the coming week. Michael.

It sounds in a near future we will compile LCL applications containing .lfm and produce web forms ... ☺

Silvio Clécio -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.freepascal.org/pipermail/pas2js/attachments/20190707/b114f2c0/attachment.html>

Reply by email

warleyalex
to silvioprog

When a project have many forms I think it is more efficient load form-data inlined JSON data like EWB scheme.

For instance, a form named Accounting are stored in the file Accounting.wbs.

// Accounting.wbs------------------------
{

"ClassName": "TDialog",
"Name": "formAccounting",
"Properties": {
"Top": 0,
"Left": 0,
"Height": 535,
"Width": 597,
"Animations": { },
"CaptionBar": { "Name": "",
"Height": 44,
"Caption": "Check Accounting",
"Font": { "Name": "Segoe UI", "Size": 18, "Color": 4294967295 }, "FontIcon": { "Name": "",
"Color": -16777216,
"Size": 16 },
"Padding": { } },
"Client": { "Name": "",
"Background": {
"Fill": { "Color": 4294967295 } },
"InsetShadow": { },
"Padding": { } },
"Constraints": { },
"Corners": { },
"Layout": { },
"Margins": { },
"OutsetShadow": { "Color": 1677721600, "HorzOffset": 2, "VertOffset": 2, "Blur": 6, "Visible": true } },
"Controls": [
{ "ClassName": "TLabel",
"Name": "Label1",
"Properties": {
"Top": 8,
"Left": 8,
"Height": 22,
"Width": 56,
"Animations": { },
"Background": { },
"Border": { },
"Corners": { },
"Caption": "Caption",
"Constraints": { },
"DisplayOrder": 0,
"Font": { "Name": "Segoe UI", "Color": 4285562249 }, "Format": { },
"Layout": { "Consumption": 7, "Position": 1 },
"LayoutOrder": 0,
"Margins": { "Left": 4, "Top": 4, "Right": 4, "Bottom": 4 }, "OutsetShadow": { },
"Padding": { } } },
{ "ClassName": "TBrowser",
"Name": "Browser1",
"Properties": {
"Top": 30,
"Left": 0,
"Height": 426,
"Width": 589,
"Animations": { },
"Background": {
"Fill": { "Color": 4294967295 } },
"Border": {
"Top": { "Color": 4292797157, "Width": 2, "Visible": true }, "Left": { "Color": 4292797157, "Width": 2, "Visible": true }, "Right": { "Color": 4292797157, "Width": 2, "Visible": true },
"Bottom": { "Color": 4292797157, "Width": 2, "Visible": true } },
"Constraints": { },
"Corners": { },
"DisplayOrder": 1,
"InsetShadow": { },
"Layout": { "Position": 1, "Stretch": 8 },
"LayoutOrder": 1,
"Margins": { },
"OutsetShadow": { },
"Padding": { } } } ]
}
------------------------
When you compile the project, the data must be embedded inline at main HTML. By giving the JSON data a non-standard type in the -----------
Note:
The type="application/json" is needed to prevent browser from parsing it while loading.
This will work just fine in all browsers.

After that, you can use it in the main script, you can access the form data:

JSON.parse(document.getElementById('TformAccounting').innerHTML);

When you load a large document, a big project with dozens forms, the larger is the benefit.

Reply by email

Michael Van Canneyt
to warleyalex
warleyalex wrote
When a project have many forms I think it is more efficient load form-data inlined JSON data like EWB scheme.

[snip]

Show quoted text 12 lines
------------------------ When you compile the project, the data must be embedded inline at main HTML. By giving the JSON data a non-standard type in the ----------- Note: The type="application/json" is needed to prevent browser from parsing it while loading. This will work just fine in all browsers. After that, you can use it in the main script, you can access the form data: JSON.parse(document.getElementById('TformAccounting').innerHTML);

Or you can put it in a data tag.

When you load a large document, a big project with dozens forms, the larger is the benefit.

FPC has a structure where the streaming is not necessarily in a binary scheme. There is somewhere a reader/writer that uses JSON. There is also one that uses XML.

So your idea should be easily implemented: the structure is now in place.

Michael.

Reply by email