Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

Wrong calcuation of Row-Height - Scrolling not possible

TElTreeView.GetVisCount2 is a too simplied calcuation which doesn't respect different heights of rows

We enhance the code to this:

function TElTreeView.GetVisCount2: Integer;
var
  j: Integer;
  CliHeight: Integer;
begin
  CliHeight := Height;
  j := FOwner.FLineHeight;

  // RowHeight can be different, so calculat it row by row
  var diff := 0;

  for var i := FOwner.TopIndex to Min(FOwner.TopIndex + FOwner.TotalVisCount, FOwner.Items.Count) - 1 do
    Inc(diff, FOwner.Items[i].Height - j);

  Result := (CliHeight - diff) div j;
end;

Comments

Sign In or Register to comment.