[Pas2js] Pas2JS-Widgets with LFM streaming

Michael Van Canneyt michael at freepascal.org
Sat Jul 27 13:47:27 CEST 2019



On Sat, 27 Jul 2019, Sven Barth wrote:

> That's what I assume as well.
>
>> Maybe a <link> element is better ?
>
> Nope, no difference. It seems injecting directly into the HTML or dynamic 
> loading are the only possibilities if I want to use the LFM format as is.

Looks like it, yes :(

My personal preference would be a data-formdata-formname attribute,
and base64-encode the LFM.

>>> Yes. Though I'd really like to know how TMS dealt with the sizes. 
>>> Currently the problem is when I do this on a 92 DPI Lazarus (my Win7 at 
>>> work) I get buttons and labels that are too small for their contents and 
>>> on my HighDPI Win10 the button and label looks huge compared to the 
>>> content... (obviously the widgets need to deal with the different 
>>> sizes/take into account the design DPI, but the principal problem of 
>>> WYSIWYG remains)
>> 
>> This is the problem of VCL/LCL : an outdated concept of (fixed) layout.
>
> Which brings me back to the question: how did TMS solve this? After all 
> they're using the normal form designer as well...

I have no idea. Maybe they didn't solve it yet.

>> TApplication.Run then needs to wait till the main form is loaded before
>> showing it.
>
> But how can TApplication.Run wait when waiting in the main thread is frowned 
> upon or not really working?
>
> Though I just noticed that TApplication.Run looks like this:
>
> === code begin ===
>
> procedure TApplication.Run;
> begin
>   { TODO: Add a background to the application }
>   RegisterHandleEvents;
>   LoadIcon;
>   if (Assigned(FMainForm)) then
>   begin
>     FMainForm.Show;
>   end;
> end;
>
> === code end ===
>
> So it might be useful to kick out the if-clause and only rely on asynchronous 
> loading.

Exactly what I was getting at. And if it works asynchronously, it can work
synchronously as well.

>
> Of course there is more trouble ahead if a form depends e.g. on a data module 
> and thus the latter must be loaded before the former... Oh well, no one said 
> that it would be easy...

No, it is not.
That is why the rtl.unitloader does a dependency check and recursive
loading...


Michael.


More information about the Pas2js mailing list