ADUG - TMS Web Core Study Group - Third Meeting

Hello Follks!

The next TMS Web Core study group meetin is on at

Thursday, 4th Novembber 2021 at 7:30 PM (AEDST) on Zoom.

Here are the meeting details:

CU there.

Salut,
Mathias

1 Like

Hi Mathias, since we’ve come out of lockdown and some sort of normal life has resumed, I can no longer do Thursdays. So I won’t be able to make it unfortunately.

Is there another weekday that suits you better?

Salut,
Mathias

Mondays and Wednesdays work, but I don’t expect everyone else to change.

I shall ask on Thursday & keep you informed

Salut,
Mathias

1 Like

Hello Malcolm,

we had our meeting tonight and we settled for the 1st & 4th Monday of the month. Therefore the next meeting will be on the 22nd November 2021 at 7:30 PM (AEDST).

Salut,
Mathias

1 Like

We had a good meeting yesterday looking at the way the Web Core works. I am coming to developing for the web as a complete novice and therefore there is a lot that is unclear to me. Some of what I am saying here will therefore be obvious to many if not most of you but I think it would be good to put down the observations nevertheless in case it is of use to anyone else.

Variants
TMS Web Core essentially allows two different types of apps to be created :-

  1. A web application which is meant to be run in the browser.
  2. A stand alone app (using TMS Miletus) which can be run on either Windows, Linux or the Mac. This produces a relatively large EXE (or equivalent for the platform) which contains your code as well as a JavaScript engine to actually run the code.

In both cases Web Core translates your Pascal code into JavaScript. The essential difference being that in one case the JavaScript engine is in your browser and the other it is embedded in your app.

Miletus App
We ran a sample application that Mathias built on the fly which was essentially a “hello world”. It worked well on Windows albeit with a relatively large Exe file size and is probably comparable to Fire Monkey. One of the things I would like to explore further is what kinds of widgets are provided from TMS and compatible with the Miletus framework.

In terms of producing an executable (.APP) for the Mac, it does appear to work but the resulting application did not actually display any widgets. It was just a white rectangle window with nothing on it. Whether this is a quirk of my own Mac set up or whether there is some other setting that needs to be configured is unknown at this time but something I want to explore further in the next week or so. If it can be done, it seems to be much easier than using the FireMonkey route of setting up the PA Server on the host mac and also with this approach you don’t even need a Mac to produce the output file. Mathias was able to compile and send me the application without needing to be on a Mac. So there is definitely some benefit with this approach once we get it working of course.

Web Apps
Compiling for the web produces a set of files - a HTML file for the overall app itself and one for each form in your app. When you run the app in Delphi, a browser window fires up and you see your app running in that browser. You can then test the functionality.

One thing that stumped me at first was how to get this thing which was running in the browser in a Windows VM, working on my Mac. Naively I had thought that opening the Main.HTML file would work. This does not and for reasons which are now obvious but weren’t clear to me before. When the file is opened in the browser, the browser has no access to the file system. Therefore when the browser encounters a line like :-

script type=“text/javascript” src="[MultiTab.js]

it cannot actually access this javascript file. When the app is run from Delphi the URL in the browser window is something like :-
http://localhost:8000/MultiTab/Main.html

So what Web Core is doing is setting up a server running on the port 8000 in order to serve the app up. Clearly the browser is able to interrogate the server and get the JS file or any other of the files that the app needs. Again apologies if this is obvious to you. Opening the main.html file directly in the browser even on Windows just does not work.

The solution then on the Mac is to copy the HTML and JS files to a folder somewhere on the file system. You can then fire up a web server on the Mac.

One easy way to do this (but not necessarily the best or only way) is to install the http-server on your machine from the command line :-

npm install http-server -g

You might have to run this as the Super User.

You then from the command line navigate to the folder where you have copied the output files from Web Core and then run :-

http-server -p 8000

You can then open the URL on your browser and get the app running :-

http://localhost:8000/main.html

So all in all a good introduction to getting the apps running and with that bit of configuration understood it is on to the more interesting task of seeing what useful stuff can actually be done with the tool.

2 Likes

Thanks guys, much appreciated.

I demoed a project showing control of DOM. You can change various attributes, classes and contents of HTML. You can also link events from pure HTML entities back to Delphi.

Sooner or later you may need to do this in your own project. So I have uploaded the source here as a reference. Dom Fiddles

2 Likes

Hi Rohit. The Dom Fiddles download contains 2 files: PING_LOG.EXE, and PING_LOG.PDF. I am interested in the real DOM Fiddles! Best regards, Erwin

Oops, try again.

1 Like

Due to website restructure, Url has changed to New Dom Fiddles