Color not in color table (error)

I have a web core application fully working in Visual Studio Code and now I want to continue working on it in Delphi Alexandria. WebCore version is
The application loads in delphi and I can open the project source. It compiles, runs and works fine, but if I open any form it won't compiles nor runs. Also can not view the forms as text, because it shows an error dialog with the same message.

The error message is "Color is not in color table". The compiler does not point to any specific line, so I suspect is in the form's creation or descriptor. Many colors used are in the delphi nomenclature (like clBlack).and some other are custom, like $00F7D9F1.

I have done this before (starting in VSC then moving to Delphi) without this problem. When going backor moving my projects to VSC usually I have to change VCL uses to WEBLib and editing the forms in text editor to remove some component properties like HeightPercent, but that is pretty much all.

In this case, maybe when moving the project to delphi I need to change some "uses" declaration or similar.

Any idea is well appreciated.

I have not encountered such problem before.
I could not see an issue here when using color $00F7D9F1.
Could you isolate this and send a sample source project with which we can reproduce the problem here?

Well I found the problem and it was located on a webImageControl property ( that perhaps the visual studio code version did not load correctly, and when moving the project to delphi makes it crash. But it works fine in VSC.

I manage to reproduce the issue and am attaching here a form with the failing property..

To produce the error, just load the .pas, then switch to form with F12 in Delphi, then right-click on the form and "View as text".
It seems that delphi is not able to handle the error and it has trouble even saving or editing the form, so the only solution is:

  • Close Delphi
  • Open unit1.dfm in notepad or similar text editor
  • Remove the offending property in the text dfm and save the file
  • Reopen Delphi, load the form and Reloading the picture into the webImageControl.

When done in Delphi, the property in the dfm file is very long, as it should be for a picture descriptor.

I annotated some components in the form indicating the above.

Finally, a separate issue, but maybe is a good time to verify that the component properties are the same in VSC and Delphi so they can be moved back and forth between IDEs without editing the dfm files for missing or unknown properties... (9.3 KB)

We will investigate

I checked this and see that indeed Picture.Data is set as well as URL is set.
This is not what is expected. It should be EITHER URL is set or Picture.Data is set.
When I set URL in TWebImageControl both in VSC and in Delphi, it does not affect Picture.Data, i.e. it remains {}
When I load a picture in VSC, it sets the (long) Picture.Data that is used in turn in Delphi.
So, in a nutshell, I can see the error in your form file, but I could not find steps to bring the DFM file in the state as you have it. If you have reproducible steps, this would help to understand and look for a solution.

After reading your reply, I loaded the picture a number of times and you are right, VSC in Windows and Mac loads the full picture data.
BUT... I don't recall filling the picture data myself or loading the picture in a la delphi, because being a web application I filled the URL text instead for all images on the original project. But I surely cleared the picture to make sure it is initialized.
So I ran some random sequences and found a problem. I followed this sequence and seems to produce the problem every time (VSC, WebCore and all components are current to Mar. 26, 2023, and windows 11 is the latest as well).

a) Open a project in VSC with an empty WebImageControl in a form. (I attached here my test project) and open the form. The and URL are empty when starting.
b) View the form as text. Picture data and URL are empty there too.
c) Now go and in the WebImage, open the dialog to load a picture but click "clear" instead. It immediately puts some data in the Picture.Data field. Seems the same as the data I was having problem wnen moving the project to Delphi.
d) The form as text (.dfm) has now the same data there in the field.
e) Run the project, and it runs normally, with an empty image.
f) Now fill the URL field with the test image. The will not change and the program runs normally. The strange data in is still there.

Screen capture Video: webimage behaviour.mp4 - Google Drive

Project: (27.6 KB)

(Clearing the picture in delphi seems to work fine)

Thanks for these details that helped us to reproduce.
We're investigating how to fix.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

We've applied a fix and we'll release an update to address this.