mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-09 10:38:14 +02:00
lcl/(shell)treeview: Fix FindNodeWithTextPath not working for ShellTreeView in Linux.
This commit is contained in:
parent
3f3e32ce9b
commit
1b3c13f9b9
@ -2663,8 +2663,15 @@ end;
|
|||||||
function TTreeNodes.FindNodeWithText(const NodeText: string): TTreeNode;
|
function TTreeNodes.FindNodeWithText(const NodeText: string): TTreeNode;
|
||||||
begin
|
begin
|
||||||
Result := GetFirstNode;
|
Result := GetFirstNode;
|
||||||
|
if (foFindIgnoresCase in FOwner.FFindOptions) then
|
||||||
|
begin
|
||||||
|
while Assigned(Result) and not SameText(Result.Text, NodeText) do
|
||||||
|
Result := Result.GetNext;
|
||||||
|
end else
|
||||||
|
begin
|
||||||
while Assigned(Result) and (Result.Text <> NodeText) do
|
while Assigned(Result) and (Result.Text <> NodeText) do
|
||||||
Result := Result.GetNext;
|
Result := Result.GetNext;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TTreeNodes.FindNodeWithTextPath(TextPath: string): TTreeNode;
|
function TTreeNodes.FindNodeWithTextPath(TextPath: string): TTreeNode;
|
||||||
@ -2675,31 +2682,19 @@ begin
|
|||||||
for CurText in TextPath.Split(FOwner.FPathDelimiter) do
|
for CurText in TextPath.Split(FOwner.FPathDelimiter) do
|
||||||
begin
|
begin
|
||||||
if Result = nil then
|
if Result = nil then
|
||||||
Result := FindTopLvlNode(CurText)
|
begin
|
||||||
else begin
|
if CurText = '' then
|
||||||
|
Result := FindTopLvlNode(FOwner.FPathDelimiter)
|
||||||
|
else
|
||||||
|
Result := FindTopLvlNode(CurText);
|
||||||
|
end else begin
|
||||||
if (foFindExpands in FOwner.FFindOptions) then
|
if (foFindExpands in FOwner.FFindOptions) then
|
||||||
Result.Expanded := true;
|
Result.Expanded := true;
|
||||||
Result := Result.FindNode(CurText);
|
Result := Result.FindNode(CurText);
|
||||||
|
if Result = nil then
|
||||||
|
break;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{
|
|
||||||
repeat
|
|
||||||
p:=System.Pos(FOwner.FPathDelimiter,TextPath);
|
|
||||||
if p>0 then begin
|
|
||||||
CurText:=LeftStr(TextPath,p-1);
|
|
||||||
System.Delete(TextPath,1,p-1+Length(FOwner.FPathDelimiter));
|
|
||||||
end else begin
|
|
||||||
CurText:=TextPath;
|
|
||||||
TextPath:='';
|
|
||||||
end;
|
|
||||||
//debugln(['TTreeNodes.FindNodeWithTextPath CurText=',CurText,' Rest=',TextPath]);
|
|
||||||
if Result=nil then
|
|
||||||
Result:=FindTopLvlNode(CurText)
|
|
||||||
else
|
|
||||||
Result:=Result.FindNode(CurText);
|
|
||||||
until (Result=nil) or (TextPath='');
|
|
||||||
}
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TTreeNodes.FindNodeWithData(const NodeData: Pointer): TTreeNode;
|
function TTreeNodes.FindNodeWithData(const NodeData: Pointer): TTreeNode;
|
||||||
|
Loading…
Reference in New Issue
Block a user