TAdvEdit font colors question

I am trying to change the font color of a TAdvEdit under certain conditions but it just displays black. I even tried setting the color in the Delphi 11.3. UI. Might the fact that my program uses styles change how I should set the font colors? All I try to do is to set the font color or the label font color to clRed. Must be something obvious that I am not setting.


With a default TAdvEdit on the form and the code:

procedure TForm1.FormCreate(Sender: TObject);
advedit1.Font.Color := clRed;
advedit1.FocusFontColor := clRed;

the font is red, both when the control has focus and not.

Thanks for the quick response. I had not noticed that there was a FocusFontColor option. I think I can fix things now. You are helpful as always!

I did a little more work. Styles were the problem. If I add the following line I can then change font colors:

UassignedEdit.StyleElements := UassignedEdit.StyleElements - [seFont];

UassignedEdit is the name of a TAdvEdit that I am using to display a bad value.

If you use VCL styles, these color settings take priority, unless you change control.StyleElements
This is by design.