Page 1 of 1

Multi-line node text not correctly displayed

Posted: Mon Jul 14, 2014 11:19 am
by 16567585
In the TTree component of TeeChart 2014 of May 12, 2014, multi-line node text not correctly displayed, if the line count is even.
Therefore line 4164 in TeeTree.pas, function TTreeNodeShape.DrawText

Code: Select all

vtaCenter: tmpPosY:=tmpMidY + Round( (t*tmpH) - ((tmpCount div 2)*tmpH) - (tmpH*0.5) );
has to be fixed as follows:

Code: Select all

vtaCenter: tmpPosY:=tmpMidY + Round( (t*tmpH) - ((tmpCount div 2)*tmpH) - (tmpCount mod 2)*(tmpH*0.5) );

Re: Multi-line node text not correctly displayed

Posted: Tue Jul 15, 2014 2:17 pm
by yeray
Hello,

I can't reproduce the problem here with the following code:

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
var i: Integer;
begin
  TreeNodeShape1.Text.Clear;
  for i:=0 to 10 do
   TreeNodeShape1.Text.Add('Line ' + IntToStr(i));
end;
What have I incorrectly understood?

Re: Multi-line node text not correctly displayed

Posted: Thu Jul 24, 2014 5:42 am
by 16567585
You added an odd number of lines (0 to 10) to the shape. The following code reproduces the problem:

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
var i: Integer;
begin
  TreeNodeShape1.Text.Clear;
  for i:=1 to 10 do
   TreeNodeShape1.Text.Add('Line ' + IntToStr(i));
end;

Re: Multi-line node text not correctly displayed

Posted: Mon Aug 04, 2014 12:04 pm
by yeray
Hello,

Sorry for the confusion. I could reproduce the problem (so I added it to the public tracker B875) and also checked your suggestion fixes it, so I've implemented the change and the next maintenance release will include it.