EReadError with TColor published properties in FMX

  

In an FMX component, I have this definition:

published
property BackgroundColor: TColor read fBackgroundColor write fBackgroundColor;
end;

If BackgroundColor is set to a const, like clRed, then I get an EReadError “Error reading BackgroundColor: Invalid property value”.

It works with a normal value, like $00FF8000. So why does the Object inspector let you select a const???

The workaround is to declare the property as TAlphaColor, but that means another conditional define in my combined VCL/FMX unit.

Is there any other way I can keep the property as TColor?

Delphi 10.3.2

Comments are closed.