× CodeTyphon Web Development Pas2JS, WASM, etc, discussions and problems

Question pas2js create web components at runtime

  • Michael
  • Topic Author
  • Offline
  • New Member
  • New Member
More
1 month 2 weeks ago #16327 by Michael
Dear all,

I am very happy, that the web components and the pas2js transpiler made it into Code Typhon. I use Ubuntu 20.04, on x86.64, with CT 7.7. I looked on the 3 example project with the web components. This looks all very interesting.
But I am not able, to create new components at runtime. Well, the compiler accept all, but no components become visible in the browser app. For example:
     wLbl1 := TWLabel.Create(WForm1); //WForm1 is TWForm
     wLbl1.Left := 410;
     wLbl1.Top := 115;
     wLbl1.Caption:= 'Hallo';
     wLbl1.Parent := WForm1; 

With VCL application, calling the constructor, and then setting the Parent property was all what was needed. How can the same thing be done with the web components in the Browser/Javascript?

I would like to develop some web DB-aware components.
One more thing: When inheriting web components to make new components, the overwritten constructor is not called. I guess, there is some magic, how the pas2js and the jQuery Javascript library are working together. What is the suggested way?
Any help is welcomed.

regards,
 

Please Log in or Create an account to join the conversation.

  • Matis A.
  • Matis A.'s Avatar
  • Away
  • Moderator
  • Moderator
More
1 month 2 weeks ago - 1 month 2 weeks ago #16328 by Matis A.
Replied by Matis A. on topic pas2js create web components at runtime
Put your code onShow of main WForm

procedure TWForm1.FormShow(Sender: TObject);
begin
    wLbl1 := TWLabel.Create(WForm1); //WForm1 is TWForm   
     wLbl1.Parent := WForm1;   // Parent always after Create
     wLbl1.Left := 410;
     wLbl1.Top := 115;
     wLbl1.Caption:= 'Hallo from CT';
end;             

For "overwritten constructor" I need some code sample.

This ability of CT, Web GUI app, it's new.
I hope for more components. 
 

PilotLogic Core Programmer
Last edit: 1 month 2 weeks ago by Matis A..

Please Log in or Create an account to join the conversation.

  • Michael
  • Topic Author
  • Offline
  • New Member
  • New Member
More
1 month 1 week ago #16389 by Michael
Replied by Michael on topic pas2js create web components at runtime
a test showed, the components created in the "OnShow", as you suggested, worked so far. Also the constructor is executed. So you can close this issue.
Thank you for your fast help.

Please Log in or Create an account to join the conversation.