Including VCL

Stuck trying to get a VCL/Oxygene/Water sample running. Files from GetHub.
Program.pas
Sample.elements
Sample.sln
unit2.drm
unit2.pas
index.html
When trying to build get:

Maybe I need the files RemObjects.Elements.RTL.Delphi & RemObjects.Elements.RTL.Delphi.VCL & put 'em somewhere in the project?

Do you have a reference to Delphi.fx and DelphiVCL.fx in your project?

I assume you are using this Sample: https://github.com/remobjects/ElementsSamples/tree/master/Oxygene/Island/Delphi%20VCL/Sample-Wasm? if so, that compiles clean for me.

Never heard of Del;phi.fx nor Del;phiVCL.fx. I assume they are files I need to get from somewhere & put somewhere & reference somehow?

Yes, that looks like the Sample I’m using.

If anything like RAD Studio Delphi, I will also need RemObjects.Elements.RTL.Delphi & RemObjects.Elements.RTL.Delphi.VCL files I get from somewhere & put somewhere in the project files?

Ok, open the References node, does it show Delphi and Delphi VCL there, as it does for me here:

DO you see any error marker omg them?

Can you go to Preferences and set there Build Log Verbosity to “Diagnostic” on the third tab:

and hit Rebuild, and then send me the build log (which you can view via the Messages|Show Build Log menu)?

thanx!

Sort of, yes. Check out this topic on Namespaces vs references in Oxygene: https://docs.elementscompiler.com/Oxygene/Delphi/NamespacesAndReferences/ Essentially, the Delphi and DelphiVCL references seem to be missing, they would make those namespaces available (and are used for Delphi compatibility only).

The references were there & the rebuild was successful & the page loaded in Chrome but displayed no VCL elements. The “Debug?” screen showed an “Error getting loc…” = System.NullReferenceException: Object reference not set to an instance of an object.

The “Error getting…” problem was program.HelloWorld() when the program.pas had no such method. I commented that out & runs; however, no VCL elements show up (the form with buttons, etc)

Maybe I need to call program.main() from index.html?
program.pas =
namespace Sample;
uses
RemObjects.Elements.RTL.Delphi,
RemObjects.Elements.RTL.Delphi.VCL;

type
[Export]
Program = public class
public

method Main;
begin
  Application := new TApplication(nil);
  Application.Initialize;
  Application.CreateForm(typeOf(Sample.TForm2), var Sample.Form2);
  Application.Run;
end;

end;

end.

IT WORKED!!! index.html needs to call Main()? Thanks for your patience. Am back at it.

1 Like

Works in Water, but putting files on my server, no VCL elements show, only the “Sample Test Page” with remainder of page blank, shows up in Chrome, Firefox & Edge. Bummer.

Make sure all the paths are good and match. Anything in the browser dev console?

Can you send em your changed project so I can compare? the sample is supposed to work out of the box…

Console show can’t load. Sending you image while I’m trying to figure it out.

BTW: Pong wasm sample works on server, but it has no VCL.

Could it be that you also need to enable the MIME type for the .DFM?

dfm file was not included nor a MIME type. I put the dfm file in wasm & main folder & set MIME type dfm = application/dfm. No Help! I did bring IIS down & back up when doing this, but did not restart IIS if that matters. dfm is a text file & it would seem likely the wasm file would have it built in in bit code?

It would seem to me that for VCL/WASM to work, either WASM has to generate JavaScript to create the elements (buttons, etc) or it has to create an HTML5 canvas & draw them & respond to their events. Do you know how VCL elements are created by wasm/VCL?