Steema Issues Database

Note: This database is for bugs and wishes only. For technical support help, if you are a customer please visit our online forums;
otherwise you can use StackOverflow.
Before using this bug-tracker we recommend a look at this document, Steema Bug Fixing Policy.



Bug 1160

Summary: Having an TImageShape with VertOffset on Bottom Aligned Text, the VertScrollBar doesn't calculate limits correctly
Product: VCL TeeChart Reporter: yeray alonso <yeray>
Component: TTreeAssignee: Steema Issue Manager <issuemanager>
Status: RESOLVED FIXED    
Severity: enhancement CC: david
Priority: ---    
Version: 150120   
Target Milestone: ---   
Hardware: PC   
OS: Windows   
URL: http://stackoverflow.com/questions/28926039/when-use-teetreeteecharts-one-component-build-a-imageshape-its-display-with
Chart Series: --- Delphi / C++ Builder RAD IDE Version:

Description yeray alonso 2015-03-10 07:18:25 EDT
If you place a TTree and use this code (note the Tree has to be small enough to show the Vertical ScrollBar):

procedure TForm1.FormCreate(Sender: TObject);
var i:Integer;
    imgBox:TImageShape;
    curLeft,curTop:Integer;
begin
  curLeft:=-100-15;
  curTop:=0;
  for i:=0 to 10 do
  begin
    imgBox := TImageShape.Create(Self);
    imgBox.Width := 100;
    imgBox.Height := 100;
    curLeft := curLeft + 100 + 15 * 2;
    if (curLeft + 100 + 15)>= Tree1.Width then
    begin
      curLeft := 15;
      curTop := curTop + 100 + 15 * 2;
    end;
    imgBox.Left := curLeft;
    imgBox.Top := curTop;
    imgBox.Font.Style:=[fsBold];
    imgBox.Font.Size:=16;
    imgBox.Text.VertAlign:=vtaBottom;
    imgBox.Text.VertOffset:=30;
    imgBox.Text.Add('Node'+inttostr(i));
    imgBox.Tree:=Tree1;
  end;
end;

If you use the ScrollBar to show the shapes on the bottom, the scrollbar doesn't allow you to scroll enough to see all the texts.

*********

Possible fix:
At TeeTree.pas, in the TTreeNodeShape.ReCalcPositions method there is:

  FAdjustedRect.Left:=X0;
  FAdjustedRect.Top:=Y0;
  FAdjustedRect.Right:=FX1;
  FAdjustedRect.Bottom:=FY1;

If you change it for this, the texts will be shown:

  FAdjustedRect.Left:=X0;
  FAdjustedRect.Top:=Y0;
  FAdjustedRect.Right:=FX1+FText.HorizOffset;
  FAdjustedRect.Bottom:=FY1+FText.VertOffset;
Comment 1 david berneda 2015-05-15 05:38:59 EDT
Fixed. 
A minor improvement to this test is to set the text selected color to black, otherwise selecting nodes will paint text in white color and will be invisible:

  Tree1.Selected.TextColor:=clBlack;