Delphi-style VCL on WebAssembly Platform


(RemObjects) #1

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/

(Adrian Veith) #2

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;

(Diego Navarro) #3

Hi Adrian, please, what build are you using?


(Adrian Veith) #4

Hi Diego, I am using the actual beta 2267


(Diego Navarro) #5

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


(arturredzko) #6

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


(arturredzko) #7

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


(marc hoffman) #8

Nice!


(Diego Navarro) #9

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