THTMLTreeView display issue for selected items

Edit an HTMLTreeView node text using the editor and change the text color. Then assign it back to the HTMLTreeView Node, if you then select the node, the text is blank.



I use a TAdvRichEditor 1.8.97 with a TAdvRichEditorMiniHTMLIO, and use
vNode.Text := AdvRichEditorMiniHTMLIO1.AsString to assign it to the node.

This is something that has been introduced in the last version or two of the VCL UI.
Delphi 11.3

I tested this here but I could not reproduce a problem with this test app. (5.8 KB)

When I copy/paste my code into a test project, it works there too. So I don't know what is causing this in my main app. However, I noticed the HTML being saved now has a SPAN that it didn't use to add. For example:

An entry created from an older version of the VCL UI that displays properly:

<B><FONT color="#000000">Note:</FONT></B><FONT color="#000000"> Weather conditions, drainage, leakage, and o</FONT>

Here is the latest result with a different entry that only displays properly if I move focus away from the HTML TreeView while still having the node selected (weird in itself that it only displays badly if the treeview has focus):

<SPAN style="background-color:#FFFFFF;display:inline-block"><FONT color="#000000">Interior shows </FONT><B><FONT color="#000000">evidence</FONT></B><FONT color="#000000"> of water penetration; need</FONT></SPAN>

Notice the added markup, which I do not want in any case... just want plain HTML which I set in the AdvRichEditorMiniHTMLIO (also, SpaceAsNbSp is false).

If I manually remove the SPAN markup, it works correctly as before.

I use a toolbar with actions, not the TAdvRichEditorFormatToolBar as in your example. It seems I have to click on the background color button to set the background explicitly to white to prevent the SPAN markup from being added. Even if it is already set to white, I still have to set it again to white each time I edit the caption.

It's possible this all started when I moved from the TAdvRichEditorFormatToolBar to my own toolbar with your actions and no customer noticed the problem until now. Either that or maybe the load or Insert is defaulting the background color incorrectly such that is has to add the SPAN markup?

I know this doesn't solve my problem in cases where the customer wants a background color other than white (my app still has the issue with the SPAN markup, but the example doesn't.. still looking at that).

The editor color itself is set to clWindow. If I set it a design time to clWhite, I don't get the SPAN nor do I have to explicitly set it to white. So that's one small step.

However, don't you think clWindow should be the "no-color" trigger rather than clWhite?

Found the problem. In my treeview, the setting for SelectionFontColor is, and has always been, clHighlighText. When copy/pasting that treeview over to an example, the SelectionFontColor was changed to $003B3B3B, which is the same as in your example. Not sure why it changed the color under me..

So, when I change it to that color, it works fine. I have never changed that color in my app, so somewhere along the line you guys maybe changed the default that I didn't hear about? Is that possible? FWIW, I have eight instances of THTMLTreeView in my app, all had clHighlightText except for two which has the $003B3B3B color, so I figure they must have been added later.

We've seen this issue with incorrect initialization of SelectionFontColor.
We fixed this now. The next update will address this.

Related issue. If I switch styles, the selection color is fine. However, when I switch back to the default windows style, it paints half the selection in a dark color and the other half in the previously selected style color.

Example. Normal default window style:

Iceberg Classico:

Back to normal default window style:

The SelectionColors at design time at all set to $00F2E1D5. I tried updating the VCL UI to, which includes THTMLTreeView and made no difference with these colors. Even forcing those colors when switching back to the default windows style did nothing except to make the lower half the right color of $00F2E1D5 (upper half was still the dark blue.

I noticed in your htmltv.pas unit, for the InitVCLStyle procedure, the "If FUserVCLStyles" is missing the ColorMirrorFrom and ColorMirrorTo assignments which is causing the top half to be the only color reset. However, clHighlight is not the color that should be used, it should be the color set at design time if at all possible.

If not possible, then also set the SelectionFontColor to clHighlightText to correspond to the clHighlight background color.

For now, what I've done is to comment out the three SelectionColors you do have and then in my code I force all the colors to the colors as designed whenever I switch back to the Windows Default style.

Thanks for notifying.
We implemented improvements for this