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

Columnstroke in TAdvTreeView

 Post Reply Post Reply
Author
Ronald Janse View Drop Down
Senior Member
Senior Member
Avatar

Joined: 20 Aug 2015
Posts: 265
Post Options Post Options   Quote Ronald Janse Quote  Post ReplyReply Direct Link To This Post Topic: Columnstroke in TAdvTreeView
    Posted: 17 May 2019 at 10:58am
I want to devide the columns in my TAdvTreeView with a vertical line of 1 pixel in diameter. This seems to be not possible.
The only way to get a vertical line is to set NodesAppearance ColumnStroke Width to 1. But then the columns get a line of 1 around them on all sides, resulting in a vertical line with a width of 2 between the columns. The headers do have a vertical line of 1...
Back to Top
Bruno Fierens View Drop Down
TMS Support
TMS Support
Avatar

Joined: 11 May 2010
Posts: 7894
Post Options Post Options   Quote Bruno Fierens Quote  Post ReplyReply Direct Link To This Post Posted: 18 May 2019 at 9:01am
You're correct. We will fix this.
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: 20 May 2019 at 10:34am
Hi,

We'll look into improving/fixing the behaviour, but you can also workaround it by drawing a line instead of a rectangle with the following code:

procedure TForm1.AdvTreeView1AfterDrawColumn(Sender: TObject; ACanvas: TCanvas;
  ARect: TRectF; AColumn: Integer);
begin
  ACanvas.MoveTo(Round(ARect.Right), Round(ARect.Top));
  ACanvas.LineTo(Round(ARect.Right), Round(ARect.Bottom));
end;

procedure TForm1.AdvTreeView1BeforeDrawColumn(Sender: TObject;
  ACanvas: TCanvas; ARect: TRectF; AColumn: Integer; var AAllow,
  ADefaultDraw: Boolean);
begin
  ADefaultDraw := False;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  AdvTreeView1.ColumnStroke.Style := psSolid;
  AdvTreeView1.ColumnStroke.Color := clRed;
end;
Back to Top
Ronald Janse View Drop Down
Senior Member
Senior Member
Avatar

Joined: 20 Aug 2015
Posts: 265
Post Options Post Options   Quote Ronald Janse Quote  Post ReplyReply Direct Link To This Post Posted: 20 May 2019 at 1:14pm
This workaround does not work when the GetNodecolor event is used, as I do. I use it to get colored rows like this:
procedure TFormEenKolomTree.TVGetNodeColor(Sender: TObject; ANode: TAdvTreeViewVirtualNode; var AColor: TColor);
begin
  if (ANode.Children = 0) then
  begin
    if (ANode.Index mod 2) = 0 then AColor := clWhite
    else AColor := $00F4F4F4;
  end;
end;

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: 20 May 2019 at 1:47pm
The column stroke is always painted under the nodes, therefore, filling the nodes will override the line drawing. We have added this on our todolist for further investigation.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down