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 - Having an TImageShape with VertOffset on Bottom Aligned Text, the VertScrollBar doesn't calculate limits correctly
Summary: Having an TImageShape with VertOffset on Bottom Aligned Text, the VertScrollB...
Status: RESOLVED FIXED
Alias: None
Product: VCL TeeChart
Classification: Unclassified
Component: TTree (show other bugs)
Version: 150120
Hardware: PC Windows
: --- enhancement
Target Milestone: ---
Assignee: Steema Issue Manager
URL: http://stackoverflow.com/questions/28...
Keywords:
Depends on:
Blocks:
 
Reported: 2015-03-10 07:18 EDT by yeray alonso
Modified: 2015-05-15 05:38 EDT (History)
1 user (show)

See Also:
Chart Series: ---
Delphi / C++ Builder RAD IDE Version:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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;