mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-24 15:39:20 +02:00
lcl: skip not expanded nodes when we count max right (bug #0012799)
git-svn-id: trunk@18191 -
This commit is contained in:
parent
12e937579c
commit
e163b4a2dc
@ -3105,7 +3105,8 @@ begin
|
||||
end;
|
||||
|
||||
procedure TCustomTreeView.UpdateMaxRight;
|
||||
var Node: TTreeNode;
|
||||
var
|
||||
Node: TTreeNode;
|
||||
i: integer;
|
||||
FMaxTextLen: Integer;
|
||||
Cnt: Integer;
|
||||
@ -3115,22 +3116,32 @@ begin
|
||||
FMaxTextLen := 0;
|
||||
Node := Items.GetFirstNode;
|
||||
Cnt := 0;
|
||||
while Node<>nil do begin
|
||||
while Node <> nil do
|
||||
begin
|
||||
if not Node.AreParentsExpanded then
|
||||
begin
|
||||
Node := Node.GetNext;
|
||||
Continue;
|
||||
end;
|
||||
inc(Cnt);
|
||||
if (Cnt<100) then begin
|
||||
if (Cnt < 100) then
|
||||
begin
|
||||
i := Node.DisplayTextRight;
|
||||
end else begin
|
||||
end else
|
||||
begin
|
||||
// computing DisplayTextRight is too expensive when the tree
|
||||
// has hundreds of nodes
|
||||
// => use a heuristic
|
||||
if Cnt = 100 then
|
||||
i := Node.DisplayTextRight + 100
|
||||
else if length(Node.Text)>FMaxTextLen then
|
||||
else
|
||||
if length(Node.Text) > FMaxTextLen then
|
||||
i := Node.DisplayTextRight + 100
|
||||
else
|
||||
i := FMaxRight;
|
||||
end;
|
||||
if FMaxRight<i then begin
|
||||
if FMaxRight < i then
|
||||
begin
|
||||
FMaxRight := i;
|
||||
FMaxTextLen := length(Node.Text);
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user