mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 09:59:20 +02:00
LCL: TTreeView: accelerated TTreeNode.Index
git-svn-id: trunk@18569 -
This commit is contained in:
parent
542aea22d8
commit
f59b54561e
@ -1004,6 +1004,7 @@ begin
|
|||||||
// many algorithms uses the last sibling, so we check that first for speed
|
// many algorithms uses the last sibling, so we check that first for speed
|
||||||
if (Parent<>nil) and (Parent[Parent.Count-1]=Self) then begin
|
if (Parent<>nil) and (Parent[Parent.Count-1]=Self) then begin
|
||||||
Result:=Parent.Count-1;
|
Result:=Parent.Count-1;
|
||||||
|
FIndex:=Result;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
// count previous siblings
|
// count previous siblings
|
||||||
@ -1011,8 +1012,13 @@ begin
|
|||||||
ANode := Self;
|
ANode := Self;
|
||||||
while ANode <> nil do begin
|
while ANode <> nil do begin
|
||||||
Inc(Result);
|
Inc(Result);
|
||||||
|
if ANode.FIndex>=0 then begin
|
||||||
|
inc(Result,ANode.FIndex);
|
||||||
|
break;
|
||||||
|
end;
|
||||||
ANode := ANode.GetPrevSibling;
|
ANode := ANode.GetPrevSibling;
|
||||||
end;
|
end;
|
||||||
|
FIndex:=Result;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TTreeNode.GetItems(AnIndex: Integer): TTreeNode;
|
function TTreeNode.GetItems(AnIndex: Integer): TTreeNode;
|
||||||
|
Loading…
Reference in New Issue
Block a user