THTMLTreeView color and VCL themes

When I choose a dark VCL Theme like Carbon, the THTMLTreeView background is black but each item has a white background by default making the treeview display rather odd.  I know that since each item can have its own background color, but can't you have it ignore the VCL Theme background color and instead make the background color the same color as the default item's background color (i.e. white)?

I did try setting the Color property to clWhite which made no difference.

We traced & solved this issue. The next update will address this.

I downloaded and it is better but I think there is an issue with the HTML editor and themes causing me problems now.  I edit entries for the HTMLTreeview using AdvRichEditor with TAdvRichEditorMiniHTMLIO1. Each entry starts as plain text which the user can edit.  When this plain text is edited, it shows up in the editor as black text on a white background even though the editor is using the Theme's black background for the editor.  I believe the editor should not be defaulting the background color to be white nor the text color to be black.  It is plain text and should just default to auto (no color assignment so it takes on the theme's color).  I know this is tricky since the user can switch themes at anytime so you would want the text and background to not have a specific color assigned via a style attribute unless the user made it that color.

So, simply by editing the plain text and changing one word to orange, it resulted in this HTML:
<SPAN style="background-color:#FFFFFF;display:inline-block">Condensate drain <FONT color="#FF8040">stopped</FONT> up; needs service</SPAN>

You can see that it has set the background to white, but I did not want it white.

This is then displayed poorly in the THTMLTreeView because the text background is now white but the text color is the theme's text color (nearly white), making all the text except the orange word unreadable.  Had the editor not set the background color, we would be good IMHO.

Maybe I should address this as an HTML editor issue?

Note that if you edit when the theme has a white background, the HTML editor does not add the background color style attribute.  It seems to only add it when the theme background color is not white.  So there is a disconnect there somewhere.

I could not reproduce this.

This is the code used to copy the HTML from the TAdvRichEditor to the THTMLTreeView node:
procedure TForm1.Button1Click(Sender: TObject);
  memo1.Lines.Text := AdvRichEditor1.ContentAsHTML();
  htmltreeview1.Items[0].Text := memo1.Lines.Text;

Bruno Fierens2019-04-03 10:44:51

How are you loading the AdvRichEditor with the plain text?  If I use this, it sets the background color to white (pHtmlCaption is plain text initially)::


We use following to set the text:

  advricheditor1.InsertMultiLineText('hello world');

and the code to set the treeview node with the HTML text:

  htmltreeview1.Items[0].Text := advricheditor1.ContentAsHTML();

Thanks, that works.  I had used AdvRichEditorMiniHTMLIO1.Insert  based on the documentation I ran into which said:

Finally, one more helper method is available in TAdvRichEditorMiniHTMLIO: procedure Insert(HtmlValue: string); This inserts the formatted text from a HTML formatted string at caret position in the TAdvRichEditor. 

Perhaps there is a bug in that Insert code which is setting the background color incorrectly to white based on a dark theme like Carbon and insertion of plain text.

I spoke too soon.  I think I went with the TAdvRichEidtorMiniHTMLIO because when I then edit the now HTML formatted text, it is having me edit HTML directly which is not what I want.  For example, InsertMultilineTxt (or InsertText) methods of non-plina text wants em to edit this:


I do not want the user to know anything about HTML, so I used the AdvRichEditorMiniHTMLIO1.Insert method which gave me what I wanted except for the white background when editing plain text initially in a Carbon theme.

What to do?


We have fixed a bug regarding the insert of HTML text with the white background, which was coming from an internally created HTML text. Alternatively you can use the following code:

  TAdvRichEditorEx = class(TAdvRichEditor);

procedure TForm54.Button1Click(Sender: TObject);
  r: TAdvRichEditorEx;
  r := TAdvRichEditorEx.Create(Self);
    r.Parent := Self;