Web forum is in read-only mode. Login as active registered customer for write access
  Forum Search   New Posts New Posts

THTMLTreeView color and VCL themes

 Post Reply Post Reply
Author
Himmer Eric View Drop Down
Member
Member
Avatar

Joined: 18 May 2014
Posts: 83
Post Options Post Options   Quote Himmer Eric Quote  Post ReplyReply Direct Link To This Post Topic: THTMLTreeView color and VCL themes
    Posted: 11 Mar 2019 at 11:33pm
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.
Back to Top
Bruno Fierens View Drop Down
TMS Support
TMS Support
Avatar

Joined: 11 May 2010
Posts: 7895
Post Options Post Options   Quote Bruno Fierens Quote  Post ReplyReply Direct Link To This Post Posted: 13 Mar 2019 at 4:39pm
We traced & solved this issue. The next update will address this.
Back to Top
Himmer Eric View Drop Down
Member
Member
Avatar

Joined: 18 May 2014
Posts: 83
Post Options Post Options   Quote Himmer Eric Quote  Post ReplyReply Direct Link To This Post Posted: 02 Apr 2019 at 9:40pm
I downloaded 9.0.7.0 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?

Back to Top
Himmer Eric View Drop Down
Member
Member
Avatar

Joined: 18 May 2014
Posts: 83
Post Options Post Options   Quote Himmer Eric Quote  Post ReplyReply Direct Link To This Post Posted: 02 Apr 2019 at 9:51pm
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.
Back to Top
Bruno Fierens View Drop Down
TMS Support
TMS Support
Avatar

Joined: 11 May 2010
Posts: 7895
Post Options Post Options   Quote Bruno Fierens Quote  Post ReplyReply Direct Link To This Post Posted: 03 Apr 2019 at 10:43am
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);
begin
  memo1.Lines.Text := AdvRichEditor1.ContentAsHTML();
  htmltreeview1.Items[0].Text := memo1.Lines.Text;
end;





Edited by Bruno Fierens - 03 Apr 2019 at 10:44am
Back to Top
Himmer Eric View Drop Down
Member
Member
Avatar

Joined: 18 May 2014
Posts: 83
Post Options Post Options   Quote Himmer Eric Quote  Post ReplyReply Direct Link To This Post Posted: 03 Apr 2019 at 6:28pm
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)::
AdvRichEditorMiniHTMLIO1.Insert(pHtmlCaption);
Back to Top
Bruno Fierens View Drop Down
TMS Support
TMS Support
Avatar

Joined: 11 May 2010
Posts: 7895
Post Options Post Options   Quote Bruno Fierens Quote  Post ReplyReply Direct Link To This Post Posted: 04 Apr 2019 at 1:57pm
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();
Back to Top
Himmer Eric View Drop Down
Member
Member
Avatar

Joined: 18 May 2014
Posts: 83
Post Options Post Options   Quote Himmer Eric Quote  Post ReplyReply Direct Link To This Post Posted: 06 Apr 2019 at 7:52pm
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.
Back to Top
Himmer Eric View Drop Down
Member
Member
Avatar

Joined: 18 May 2014
Posts: 83
Post Options Post Options   Quote Himmer Eric Quote  Post ReplyReply Direct Link To This Post Posted: 06 Apr 2019 at 8:01pm
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:
Compressor&nbsp;cycling&nbsp;<U>underline</U>&nbsp;is&nbsp;underlined&nbsp;Gg&nbsp;Yy&nbsp;

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?
Back to Top
Pieter Scheldeman View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 3259
Post Options Post Options   Quote Pieter Scheldeman Quote  Post ReplyReply Direct Link To This Post Posted: 08 Apr 2019 at 11:09am
Hi,

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:

type
  TAdvRichEditorEx = class(TAdvRichEditor);

procedure TForm54.Button1Click(Sender: TObject);
var
  r: TAdvRichEditorEx;
begin
  r := TAdvRichEditorEx.Create(Self);
  try
    r.Parent := Self;
    r.ParseHTML('<b>test<b/>');
    r.SelectAll;
    r.CopyToClipboard;
    AdvRichEditor1.PasteFromClipboard;
  finally
    r.Free;
  end;
end;
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down