Delphi-style VCL on WebAssembly Platform

As many of you know, our Elements development environment (Fire, Water in Visual Studio) recently introduced a new Island sub-platform called WebAssembly. Code is compiled to a standard byte code format (.wasm files) that the browser can run together with JavaScript code.


This is a companion discussion topic for the original entry at https://blogs.remobjects.com/2018/03/22/delphi-visual-library-on-webassembly-platform/

When I try to click on a button I get a an exception " Function called with invalid signature". I used a simplified example:

method ButtonOnClick(Sender: TObject);
begin
  ShowMessage('You Clicked!'); 
end;

method CreateForm;
begin
  writeLn('HelloWorld');
  var lform:= new TForm(nil);
  lform.Width:= 800;
  var lButton := new TButton(lform);
  lButton.Top:= 0;
  lButton.Width:= 100;
  lButton.Caption:= 'Click Me';
  lButton.Parent:= lform;
  var lPanel:= new TPanel(lform);
  lPanel.Top:= lButton.Height  + 10;
  lPanel.Width:= 400;
  lPanel.Parent:= lform;
  lButton.OnClick:= @ButtonOnClick;
  var el := WebAssembly.GetElementById('helloWorld');
  lform.Show(el);
end;

Hi Adrian, please, what build are you using?

Hi Diego, I am using the actual beta 2267

Hi,
sorry for the delay. Please, try the upcoming today beta, all issues affecting your code had been fixed.
Thanks for your report!

I cannot find samples for WebAssembly, I’m on build .2273.

I would be nice to emulate Delphi canvas API using HTML 5 canvas context. I attach sample project Canvas.zip (2.9 KB)

Nice!

There are right now two oxygene webassembly samples. Please clone the elements sample repo (https://github.com/remobjects/ElementsSamples) and under ElementsSamples\Oxygene\Island\GUI you have:

Basic WebAssembly GUI App
Basic WebAssembly GUI Controls App

Regards