Trouble adding menu items in a project I am converting from VCL to WEB Core

If you look at the TMS WEB Core Web Server, does it give any clues as to what is going on?

Host_X.zip (292.7 KB)

I see that the Unit1 files are still present, even though I thought I had removed them from the project.

What time zone are you in? I'm in US East Coast time, 9:32 PM. I sincerely appreciate your help, but I'm gonna have to bag it soon, and get some dinner.

West Coast. Still daylight!

I've downloaded it and run it. This version didn't have the ? so I added it and ran it and the ? appeared fine. It had only three menu items so I added Help/About and it appeared fine as well.

So maybe do what I just did. Unzip that file into a new project folder and then load that project and see if you can do the same thing?

Removing the unit files from the project doesn't delete them from disk, it just doesn't include them when the project is compiled. So that's all good.

And send a screenshot of your TMS Webserver if you get a chance, I'm thinking there's a gremlin in there somewhere serving up old files. Which might be corrected if you create a new project. Or maybe it just needs to be cleared out. Click on the Base Url links and then delete them - they'll get recreated when you launch a project. Maybe you've got a link pointing to an old copy somewhere, which will show up nowhere in what we've looked at so far.

Blockquote So maybe do what I just did. Unzip that file into a new project folder and then load that project and see if you can do the same thing?

I tried that, and still saw the problem over here. I created a new directory C:\BL_WEB_Core\WebCore_Host\Host_2\ , copied the zip file there and unzipped it there. When I ran it, it showed the same problem : no "?".

When I closed the project and got back into 10.1B, I noticed problems with the locations Delphi was showing me of the files:
⦁ Project Manager hover indicates correct directories :
⦁ Hovering over bolded project name WebC_UI_0.web shows location as "C:\BL_WEB_Core\WebCore_Host\Host_2\WebC_UI_0.dproj"
⦁ Hovering over WC_UI_0.pas shows location as "C:\BL_WEB_Core\WebCore_Host\Host_2\WC_UI_0.pas"
⦁ Hovering over other files shows correct C:\BL_WEB_Core\WebCore_Host\Host_2\ directory
⦁ But when I hover over items in central Code Editor, the popup shows the PREVIOUS directory:
⦁ Hovering over file shown by Project | View source shows location correctlly as "C:\BL_WEB_Core\WebCore_Host\Host_2\WebC_UI_0.dpr"
⦁ Hovering over main form shows WRONG location : C:\BL_WEB_Core\WC_UI_0\WC_UI_0.pas
⦁ Hovering over .HTML file shows WRONG location : C:\BL_WEB_Core\WC_UI_0\WebC_UI_0.html

I removed the items from the wrong directory , and adding corresponding files from THIS project, by double clicking on the file in the Project Manager.

This allowed me to show the "?" I temporarily added to the "Find All Devices" button. It also allowed me to add the "Test" and "Help" menu items, and see them when I run the project.

So it looks like I fell for an old "gotcha" -- failing to make sure that all items shown are for THIS project ! Oldest trick in the book, and being stressed, I fell for it.

Sorry to take up so much of your time, but it gave me a chance to ask some questions and get some important responses from you. I greatly appreciate your help.

1 Like

Here's what it looks like NOW:

You're very welcome, I'm happy to help! See, I told you it would be something trivial! I'm glad you managed to get it figured out. Nothing worse than having a puzzle that you can't solve.

It also helps me in understanding what kinds of problems people have as I'm sure to have done this at some point and will likely do it again. We're all constantly learning, so maybe someone will run across this thread in the future and something in here will help them as well. Be sure to check out this thread if you've not done so already - lots of us in the same predicament.

I do hope it hasn't discouraged you in any way from using TMS WEB Core. You're just barely getting started and there is so much to explore. I find that, once up to speed, it is fantastically more powerful and interesting than the VCL could ever hope to be. So many readily available third-party libraries can be used, and your apps can instantly be updated and deployed for all your users, if you so wish.

Best of luck with the rest of your project, and don't be shy about asking questions! There are lots of other people here that are ready to help as well.

"I do hope it hasn't discouraged you in any way from using TMS WEB Core."

Not at all! WEB CORE is WAAY too important to put aside.

I sell software to control hardware. My main product these days is called HIDmaker, which generates matched, custom software for both a Windows PC and a microcontroller. Our customers can make a pretty substantial project and get it running end to end, in as little as 10 minutes.

We used to have a product called TCPmaker, that did the same for controlling hardware over Ethernet. A partner I had, devised a way to do it easily, and I developed a code generator so people could quickly create custom projects with nice GUIs. TCPmaker helped a lot of people, but it used Adobe Flash, so the product was killed when Flash went away.

I think WebCore would be a good way to revive that product, and enhance it tremendously.

1 Like

Is there a way to get a WebCore project to show more than one single error at a time?

I ask this because the original, NON-WebCore project I am trying to port to WebCore, has about a dozen files. I am going to have to rewrite some of these files, because these files were about Indy for the Ethernet work, and I am trying to switch to WebCore .

I am now at a point where I expect to get a bunch of errors to work through, so it would help a lot if I could see a bunch of them, so I can fix the easiest ones first, to speed things along.

Depends on the kinds of errors you're encountering, but generally no, it is going to stop building whenever it encounters an error, and keep in mind that the pas2js compiler can also generate its own errors. Once the project is running, JavaScript can show tons of errors while your project is running but you have to get it compiled into JavaScript first.

Honestly, I hadn't paid much attention to that before. I'm usually only able to fix one error at a time anyway, so this hasn't been much of an impediment :slightly_smiling_face:

Another question: The old Delphi 7 code that I am trying to port to WEB CORE in Delphi 10.1 Berlin is causing trouble with variant arrays in 10.1 Berlin. Error message is "[Error] BT_Types.pas(446): variant record is not supported" , Here is one of the variant records that are in dispute:

type
TIW_Record = packed record
case Integer of
0: (AsDword : Longword);
1: (LowWord, HighWord : Word);
2: (Byte0, Byte1, Byte2, Byte3 : Byte);
end;

Since Delphi docs say that variant records ARE supported by Delphi, this error message seems to mean that it is WEB CORE that doesn't support variant records, so I have to rewrite code that uses these.

Am I understanding that correctly?

Not sure off the top of my head, but sounds like you should be posting this as a new question as it might get lost down at the end of this thread :+1: :slightly_smiling_face:

What I can tell you is that this all eventually gets passed to a pas2js compiler which has its own ideas about these kinds of things, so if it isn't too terrible to rewrite these, maybe not a bad idea. But someone more knowledgeable about this than me will be better able to answer your question.

Got the same message on Delphi 10.3 so perhaps you're right - not currently supported in TMS WEB Core? I'd given them a day or so to respond though - the main support group for TMS I think is in Europe. Might not be something they can do anything about though.... Check out this link:

https://wiki.freepascal.org/pas2js#Supported_syntax_elements

It specifically says it doesn't support variant records :face_with_raised_eyebrow:

Many thanks for looking in to this! I'll try to post new as questions next time.

The TMSWebCore version of a variant is a TJSValueDynArray;:

var
  V:TJSValueDynArray;
  Jv:JSValue;
..
SetLength(V,2);
V[0]:=1;
V[1]:='Something';;
Jv:=tblX.Lookup('LevelID;Trait',V,'ImgOrder');
SetLength(V,0);
1 Like

Many thanks for that info, Ken Randall ! I'll try this in a standalone test project first, to make sure I know how to use it right.

I am trying to make a test project to try out the suggestion from Ken Randall, but the project cannot find either TJSValueDynArray or TJSValue. I need something to add to the "uses" clause.

Where can I find this?

Just a quick follow-up, answered here, in case anyone is looking later.